Skip to content

Commit 55551a9

Browse files
committed
merge main into amd-staging
2 parents 801e762 + c738308 commit 55551a9

File tree

81 files changed

+3167
-822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+3167
-822
lines changed

clang-tools-extra/clangd/InlayHints.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "llvm/ADT/StringExtras.h"
3434
#include "llvm/ADT/StringRef.h"
3535
#include "llvm/ADT/Twine.h"
36+
#include "llvm/ADT/identity.h"
3637
#include "llvm/Support/Casting.h"
3738
#include "llvm/Support/ErrorHandling.h"
3839
#include "llvm/Support/FormatVariadic.h"
@@ -375,7 +376,11 @@ static FunctionProtoTypeLoc getPrototypeLoc(Expr *Fn) {
375376
}
376377

377378
if (auto F = Target.getAs<FunctionProtoTypeLoc>()) {
378-
return F;
379+
// In some edge cases the AST can contain a "trivial" FunctionProtoTypeLoc
380+
// which has null parameters. Avoid these as they don't contain useful
381+
// information.
382+
if (llvm::all_of(F.getParams(), llvm::identity<ParmVarDecl *>()))
383+
return F;
379384
}
380385

381386
return {};

clang-tools-extra/clangd/unittests/InlayHintTests.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,11 +1011,16 @@ TEST(ParameterHints, FunctionPointer) {
10111011
f3_t f3;
10121012
using f4_t = void(__stdcall *)(int param);
10131013
f4_t f4;
1014+
__attribute__((noreturn)) f4_t f5;
10141015
void bar() {
10151016
f1($f1[[42]]);
10161017
f2($f2[[42]]);
10171018
f3($f3[[42]]);
10181019
f4($f4[[42]]);
1020+
// This one runs into an edge case in clang's type model
1021+
// and we can't extract the parameter name. But at least
1022+
// we shouldn't crash.
1023+
f5(42);
10191024
}
10201025
)cpp",
10211026
ExpectedHint{"param: ", "f1"}, ExpectedHint{"param: ", "f2"},

clang/docs/LanguageExtensions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,7 @@ to ``float``; see below for more information on this emulation.
10091009
* 64-bit ARM (AArch64)
10101010
* RISC-V
10111011
* X86 (when SSE2 is available)
1012+
* LoongArch
10121013

10131014
(For X86, SSE2 is available on 64-bit and all recent 32-bit processors.)
10141015

clang/lib/Basic/Targets/LoongArch.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo {
4949
HasFeatureLD_SEQ_SA = false;
5050
HasFeatureDiv32 = false;
5151
HasFeatureSCQ = false;
52+
BFloat16Width = 16;
53+
BFloat16Align = 16;
54+
BFloat16Format = &llvm::APFloat::BFloat();
5255
LongDoubleWidth = 128;
5356
LongDoubleAlign = 128;
5457
LongDoubleFormat = &llvm::APFloat::IEEEquad();
@@ -99,6 +102,8 @@ class LLVM_LIBRARY_VISIBILITY LoongArchTargetInfo : public TargetInfo {
99102

100103
bool hasBitIntType() const override { return true; }
101104

105+
bool hasBFloat16Type() const override { return true; }
106+
102107
bool useFP16ConversionIntrinsics() const override { return false; }
103108

104109
bool handleTargetFeatures(std::vector<std::string> &Features,

clang/lib/Sema/SemaTypeTraits.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2052,7 +2052,7 @@ static void DiagnoseNonTriviallyRelocatableReason(Sema &SemaRef,
20522052
}
20532053

20542054
if (!D->hasSimpleMoveConstructor() && !D->hasSimpleCopyConstructor()) {
2055-
const auto *Decl = cast<CXXConstructorDecl>(
2055+
const auto *Decl = cast_or_null<CXXConstructorDecl>(
20562056
LookupSpecialMemberFromXValue(SemaRef, D, /*Assign=*/false));
20572057
if (Decl && Decl->isUserProvided())
20582058
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)

clang/test/CodeGen/LoongArch/bfloat-abi.c

Lines changed: 532 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
2+
// RUN: %clang_cc1 -triple loongarch64 -emit-llvm -o - %s | FileCheck %s
3+
// RUN: %clang_cc1 -triple loongarch32 -emit-llvm -o - %s | FileCheck %s
4+
5+
// CHECK-LABEL: define dso_local void @_Z3fooDF16b
6+
// CHECK-SAME: (bfloat noundef [[B:%.*]]) #[[ATTR0:[0-9]+]] {
7+
// CHECK-NEXT: entry:
8+
// CHECK-NEXT: [[B_ADDR:%.*]] = alloca bfloat, align 2
9+
// CHECK-NEXT: store bfloat [[B]], ptr [[B_ADDR]], align 2
10+
// CHECK-NEXT: ret void
11+
//
12+
void foo(__bf16 b) {}

clang/test/SemaCXX/type-traits-unsatisfied-diags.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,50 @@ static_assert(__builtin_is_cpp_trivially_relocatable(U2));
145145

146146
}
147147

148+
149+
namespace GH143325 {
150+
struct Foo { // expected-note {{previous definition is here}}
151+
Foo(const Foo&);
152+
~Foo();
153+
};
154+
155+
struct Foo { // expected-error {{redefinition of 'Foo'}}
156+
Foo();
157+
int;
158+
};
159+
struct Wrapper { // #GH143325-Wrapper
160+
union {
161+
Foo p;
162+
} u;
163+
};
164+
165+
static_assert(__builtin_is_cpp_trivially_relocatable(Wrapper));
166+
// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(GH143325::Wrapper)'}} \
167+
// expected-note@-1 {{'Wrapper' is not trivially relocatable}} \
168+
// expected-note@-1 {{because it has a non-trivially-relocatable member 'u' of type 'union}} \
169+
// expected-note@-1 {{because it has a deleted destructor}}
170+
// expected-note@#GH143325-Wrapper {{'Wrapper' defined here}}
171+
172+
struct Polymorphic {
173+
virtual ~Polymorphic();
174+
};
175+
176+
struct UnionOfPolymorphic { // #GH143325-UnionOfPolymorphic
177+
union {
178+
Polymorphic p;
179+
int i;
180+
} u;
181+
};
182+
183+
static_assert(__builtin_is_cpp_trivially_relocatable(UnionOfPolymorphic));
184+
// expected-error@-1 {{static assertion failed due to requirement '__builtin_is_cpp_trivially_relocatable(GH143325::UnionOfPolymorphic)'}} \
185+
// expected-note@-1 {{'UnionOfPolymorphic' is not trivially relocatable}} \
186+
// expected-note@-1 {{because it has a non-trivially-relocatable member 'u' of type 'union}} \
187+
// expected-note@-1 {{because it has a deleted destructor}} \
188+
// expected-note@#GH143325-UnionOfPolymorphic {{'UnionOfPolymorphic' defined here}}
189+
190+
}
191+
148192
namespace trivially_copyable {
149193
struct B {
150194
virtual ~B();

clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ struct VerifyingConsumer {
138138

139139
void consumeInitial(DirectoryWatcher::Event E) {
140140
std::unique_lock<std::mutex> L(Mtx);
141-
auto It = std::find(ExpectedInitial.begin(), ExpectedInitial.end(), E);
141+
auto It = llvm::find(ExpectedInitial, E);
142142
if (It == ExpectedInitial.end()) {
143143
UnexpectedInitial.push_back(E);
144144
} else {
@@ -152,11 +152,9 @@ struct VerifyingConsumer {
152152

153153
void consumeNonInitial(DirectoryWatcher::Event E) {
154154
std::unique_lock<std::mutex> L(Mtx);
155-
auto It =
156-
std::find(ExpectedNonInitial.begin(), ExpectedNonInitial.end(), E);
155+
auto It = llvm::find(ExpectedNonInitial, E);
157156
if (It == ExpectedNonInitial.end()) {
158-
auto OptIt =
159-
std::find(OptionalNonInitial.begin(), OptionalNonInitial.end(), E);
157+
auto OptIt = llvm::find(OptionalNonInitial, E);
160158
if (OptIt != OptionalNonInitial.end()) {
161159
OptionalNonInitial.erase(OptIt);
162160
} else {

lldb/include/lldb/Symbol/ObjectFile.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,13 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
709709
llvm::StringRef name,
710710
lldb::SymbolType symbol_type_hint = lldb::eSymbolTypeUndefined);
711711

712+
/// Parses the section type from a section name for DWARF sections.
713+
///
714+
/// The \a name must be stripped of the default prefix (e.g. ".debug_" or
715+
/// "__debug_"). If there's no matching section type, \a eSectionTypeOther
716+
/// will be returned.
717+
static lldb::SectionType GetDWARFSectionTypeFromName(llvm::StringRef name);
718+
712719
/// Loads this objfile to memory.
713720
///
714721
/// Loads the bits needed to create an executable image to the memory. It is

0 commit comments

Comments
 (0)