Skip to content

Commit 15059ba

Browse files
authored
merge main into amd-staging (llvm#3142)
2 parents 78bade0 + ba650b8 commit 15059ba

File tree

292 files changed

+40864
-2715
lines changed

Some content is hidden

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

292 files changed

+40864
-2715
lines changed

clang-tools-extra/clang-doc/JSONGenerator.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static auto SerializeReferenceLambda = [](const auto &Ref, Object &Object) {
4545

4646
static json::Object
4747
serializeLocation(const Location &Loc,
48-
const std::optional<StringRef> &RepositoryUrl) {
48+
const std::optional<StringRef> RepositoryUrl) {
4949
Object LocationObj = Object();
5050
LocationObj["LineNumber"] = Loc.StartLineNumber;
5151
LocationObj["Filename"] = Loc.Filename;
@@ -169,7 +169,7 @@ static json::Value serializeComment(const CommentInfo &I) {
169169

170170
static void
171171
serializeCommonAttributes(const Info &I, json::Object &Obj,
172-
const std::optional<StringRef> &RepositoryUrl) {
172+
const std::optional<StringRef> RepositoryUrl) {
173173
Obj["Name"] = I.Name;
174174
Obj["USR"] = toHex(toStringRef(I.USR));
175175

@@ -211,9 +211,9 @@ static void serializeReference(const Reference &Ref, Object &ReferenceObj) {
211211
// differently. Only enums, records, and typedefs are handled here.
212212
static void
213213
serializeCommonChildren(const ScopeChildren &Children, json::Object &Obj,
214-
const std::optional<StringRef> &RepositoryUrl) {
215-
static auto SerializeInfo = [&RepositoryUrl](const auto &Info,
216-
Object &Object) {
214+
const std::optional<StringRef> RepositoryUrl) {
215+
static auto SerializeInfo = [RepositoryUrl](const auto &Info,
216+
Object &Object) {
217217
serializeInfo(Info, Object, RepositoryUrl);
218218
};
219219

@@ -304,7 +304,7 @@ static void serializeInfo(const FieldTypeInfo &I, Object &Obj) {
304304
}
305305

306306
static void serializeInfo(const FunctionInfo &F, json::Object &Obj,
307-
const std::optional<StringRef> &RepositoryURL) {
307+
const std::optional<StringRef> RepositoryURL) {
308308
serializeCommonAttributes(F, Obj, RepositoryURL);
309309
Obj["IsStatic"] = F.IsStatic;
310310

@@ -459,7 +459,7 @@ static void serializeInfo(const RecordInfo &I, json::Object &Obj,
459459
}
460460

461461
static void serializeInfo(const VarInfo &I, json::Object &Obj,
462-
const std::optional<StringRef> &RepositoryUrl) {
462+
const std::optional<StringRef> RepositoryUrl) {
463463
serializeCommonAttributes(I, Obj, RepositoryUrl);
464464
Obj["IsStatic"] = I.IsStatic;
465465
auto TypeObj = Object();
@@ -468,15 +468,15 @@ static void serializeInfo(const VarInfo &I, json::Object &Obj,
468468
}
469469

470470
static void serializeInfo(const NamespaceInfo &I, json::Object &Obj,
471-
const std::optional<StringRef> &RepositoryUrl) {
471+
const std::optional<StringRef> RepositoryUrl) {
472472
serializeCommonAttributes(I, Obj, RepositoryUrl);
473473

474474
if (!I.Children.Namespaces.empty())
475475
serializeArray(I.Children.Namespaces, Obj, "Namespaces",
476476
SerializeReferenceLambda);
477477

478-
static auto SerializeInfo = [&RepositoryUrl](const auto &Info,
479-
Object &Object) {
478+
static auto SerializeInfo = [RepositoryUrl](const auto &Info,
479+
Object &Object) {
480480
serializeInfo(Info, Object, RepositoryUrl);
481481
};
482482

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,12 @@ Improvements to Clang's diagnostics
726726
pointer, provided it can be proven that the pointer only points to
727727
``[[noreturn]]`` functions.
728728

729+
- Added a separate diagnostic group ``-Wfunction-effect-redeclarations``, for the more pedantic
730+
diagnostics for function effects (``[[clang::nonblocking]]`` and ``[[clang::nonallocating]]``).
731+
Moved the warning for a missing (though implied) attribute on a redeclaration into this group.
732+
Added a new warning in this group for the case where the attribute is missing/implicit on
733+
an override of a virtual method.
734+
729735
Improvements to Clang's time-trace
730736
----------------------------------
731737

clang/include/clang-c/Index.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6953,6 +6953,21 @@ clang_getCursorUnaryOperatorKind(CXCursor cursor);
69536953
* @}
69546954
*/
69556955

6956+
CINDEX_DEPRECATED
6957+
typedef void *CXRemapping;
6958+
6959+
CINDEX_DEPRECATED CINDEX_LINKAGE CXRemapping clang_getRemappings(const char *);
6960+
6961+
CINDEX_DEPRECATED CINDEX_LINKAGE CXRemapping
6962+
clang_getRemappingsFromFileList(const char **, unsigned);
6963+
6964+
CINDEX_DEPRECATED CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);
6965+
6966+
CINDEX_DEPRECATED CINDEX_LINKAGE void
6967+
clang_remap_getFilenames(CXRemapping, unsigned, CXString *, CXString *);
6968+
6969+
CINDEX_DEPRECATED CINDEX_LINKAGE void clang_remap_dispose(CXRemapping);
6970+
69566971
LLVM_CLANG_C_EXTERN_C_END
69576972

69586973
#endif

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ BUILTIN(__builtin_amdgcn_raw_buffer_load_b96, "V3UiQbiiIi", "n")
164164
BUILTIN(__builtin_amdgcn_raw_buffer_load_b128, "V4UiQbiiIi", "n")
165165

166166
TARGET_BUILTIN(__builtin_amdgcn_raw_ptr_buffer_load_lds, "vQbv*3IUiiiIiIi", "t", "vmem-to-lds-load-insts")
167+
TARGET_BUILTIN(__builtin_amdgcn_struct_ptr_buffer_load_lds, "vQbv*3IUiiiiIiIi", "t", "vmem-to-lds-load-insts")
167168

168169
//===----------------------------------------------------------------------===//
169170
// Ballot builtins.

clang/include/clang/Basic/BuiltinsSPIRVVK.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ include "clang/Basic/BuiltinsSPIRVBase.td"
1111

1212
def reflect : SPIRVBuiltin<"void(...)", [NoThrow, Const]>;
1313
def faceforward : SPIRVBuiltin<"void(...)", [NoThrow, Const, CustomTypeChecking]>;
14+
def refract : SPIRVBuiltin<"void(...)", [NoThrow, Const, CustomTypeChecking]>;

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ CODEGENOPT(XCOFFReadOnlyPointers, 1, 0, Benign) ///< Set for -mxcoff-roptr.
5656
CODEGENOPT(AllTocData, 1, 0, Benign) ///< AIX -mtocdata
5757
ENUM_CODEGENOPT(FramePointer, FramePointerKind, 2, FramePointerKind::None, Benign) /// frame-pointer: all,non-leaf,reserved,none
5858

59+
ENUM_CODEGENOPT(ExceptionHandling, ExceptionHandlingKind, 3, ExceptionHandlingKind::None, NotCompatible)
60+
5961
CODEGENOPT(ClearASTBeforeBackend , 1, 0, Benign) ///< Free the AST before running backend code generation. Only works with -disable-free.
6062
CODEGENOPT(DisableFree , 1, 0, Benign) ///< Don't free memory.
6163
CODEGENOPT(DiscardValueNames , 1, 0, Benign) ///< Discard Value Names from the IR (LLVMContext flag)

clang/include/clang/Basic/CodeGenOptions.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ class CodeGenOptions : public CodeGenOptionsBase {
176176
llvm_unreachable("invalid FramePointerKind");
177177
}
178178

179+
/// Possible exception handling behavior.
180+
enum class ExceptionHandlingKind { None, SjLj, WinEH, DwarfCFI, Wasm };
181+
179182
enum class SwiftAsyncFramePointerKind {
180183
Auto, // Choose Swift async extended frame info based on deployment target.
181184
Always, // Unconditionally emit Swift async extended frame info.
@@ -560,6 +563,22 @@ class CodeGenOptions : public CodeGenOptionsBase {
560563
return NoBuiltinFuncs;
561564
}
562565

566+
bool hasSjLjExceptions() const {
567+
return getExceptionHandling() == ExceptionHandlingKind::SjLj;
568+
}
569+
570+
bool hasSEHExceptions() const {
571+
return getExceptionHandling() == ExceptionHandlingKind::WinEH;
572+
}
573+
574+
bool hasDWARFExceptions() const {
575+
return getExceptionHandling() == ExceptionHandlingKind::DwarfCFI;
576+
}
577+
578+
bool hasWasmExceptions() const {
579+
return getExceptionHandling() == ExceptionHandlingKind::Wasm;
580+
}
581+
563582
/// Check if Clang profile instrumenation is on.
564583
bool hasProfileClangInstr() const {
565584
return getProfileInstr() ==

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,7 @@ def ThreadSafetyBeta : DiagGroup<"thread-safety-beta">;
12911291
// Warnings and notes related to the function effects system which underlies
12921292
// the nonblocking and nonallocating attributes.
12931293
def FunctionEffects : DiagGroup<"function-effects">;
1294+
def FunctionEffectRedeclarations : DiagGroup<"function-effect-redeclarations">;
12941295
def PerfConstraintImpliesNoexcept : DiagGroup<"perf-constraint-implies-noexcept">;
12951296

12961297
// Uniqueness Analysis warnings

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11526,17 +11526,28 @@ def note_in_evaluating_default_argument : Note<
1152611526
def warn_invalid_add_func_effects : Warning<
1152711527
"attribute '%0' should not be added via type conversion">,
1152811528
InGroup<FunctionEffects>, DefaultIgnore;
11529-
def warn_mismatched_func_effect_override : Warning<
11530-
"attribute '%0' on overriding function does not match base declaration">,
11531-
InGroup<FunctionEffects>, DefaultIgnore;
11532-
def warn_mismatched_func_effect_redeclaration : Warning<
11533-
"attribute '%0' on function does not match previous declaration">,
11534-
InGroup<FunctionEffects>, DefaultIgnore;
11529+
def warn_conflicting_func_effect_override
11530+
: Warning<"attribute '%0' on overriding function conflicts with base "
11531+
"declaration">,
11532+
InGroup<FunctionEffects>,
11533+
DefaultIgnore;
1153511534
def warn_conflicting_func_effects : Warning<
1153611535
"effects conflict when merging declarations; kept '%0', discarded '%1'">,
1153711536
InGroup<FunctionEffects>, DefaultIgnore;
1153811537
def err_func_with_effects_no_prototype : Error<
1153911538
"'%0' function must have a prototype">;
11539+
// These are more pedantic: in redeclarations and virtual method overrides,
11540+
// the effect attribute(s) should be restated.
11541+
def warn_mismatched_func_effect_override
11542+
: Warning<"overriding function is missing '%0' attribute from base "
11543+
"declaration">,
11544+
InGroup<FunctionEffectRedeclarations>,
11545+
DefaultIgnore;
11546+
def warn_mismatched_func_effect_redeclaration
11547+
: Warning<
11548+
"redeclaration is missing '%0' attribute from previous declaration">,
11549+
InGroup<FunctionEffectRedeclarations>,
11550+
DefaultIgnore;
1154011551

1154111552
} // end of sema category
1154211553

@@ -12357,7 +12368,7 @@ def err_export_using_internal : Error<
1235712368
"using declaration referring to %1 with %select{internal|module|unknown}0 "
1235812369
"linkage cannot be exported">;
1235912370
def err_export_not_in_module_interface : Error<
12360-
"export declaration can only be used within a module purview">;
12371+
"export declaration can only be used within a module interface">;
1236112372
def err_export_inline_not_defined : Error<
1236212373
"inline function not defined%select{| before the private module fragment}0">;
1236312374
def err_export_partition_impl : Error<
@@ -13478,6 +13489,12 @@ def err_acc_invalid_default_type
1347813489
def err_acc_device_type_multiple_archs
1347913490
: Error<"OpenACC 'device_type' clause on a 'set' construct only permits "
1348013491
"one architecture">;
13492+
def warn_acc_var_referenced_lacks_op
13493+
: Warning<"variable of type %0 referenced in OpenACC '%1' clause does not "
13494+
"have a %enum_select<AccVarReferencedReason>{%DefCtor{default "
13495+
"constructor}|%Dtor{destructor}}2; reference has no effect">,
13496+
InGroup<DiagGroup<"openacc-var-lacks-operation">>,
13497+
DefaultError;
1348113498

1348213499
// AMDGCN builtins diagnostics
1348313500
def err_amdgcn_load_lds_size_invalid_value : Error<"invalid size value">;

clang/include/clang/Basic/LangOptions.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ LANGOPT(Exceptions , 1, 0, NotCompatible, "exception handling")
9898
LANGOPT(ObjCExceptions , 1, 0, NotCompatible, "Objective-C exceptions")
9999
LANGOPT(CXXExceptions , 1, 0, NotCompatible, "C++ exceptions")
100100
LANGOPT(EHAsynch , 1, 0, NotCompatible, "C/C++ EH Asynch exceptions")
101-
ENUM_LANGOPT(ExceptionHandling, ExceptionHandlingKind, 3,
102-
ExceptionHandlingKind::None, NotCompatible, "exception handling")
103101
LANGOPT(IgnoreExceptions , 1, 0, NotCompatible, "ignore exceptions")
104102
LANGOPT(ExternCNoUnwind , 1, 0, NotCompatible, "Assume extern C functions don't unwind")
105103
LANGOPT(AssumeNothrowExceptionDtor , 1, 0, NotCompatible, "Assume exception object's destructor is nothrow")

0 commit comments

Comments
 (0)