Skip to content

Commit 56099e0

Browse files
author
z1_cciauto
authored
merge main into amd-staging (llvm#3023)
2 parents 876fd8a + 00998b2 commit 56099e0

File tree

129 files changed

+5853
-4243
lines changed

Some content is hidden

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

129 files changed

+5853
-4243
lines changed

clang-tools-extra/clang-tidy/ClangTidy.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ namespace clang::tidy {
5555

5656
namespace {
5757
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER
58+
#define ANALYZER_CHECK_NAME_PREFIX "clang-analyzer-"
5859
static constexpr llvm::StringLiteral AnalyzerCheckNamePrefix =
59-
"clang-analyzer-";
60+
ANALYZER_CHECK_NAME_PREFIX;
6061

6162
class AnalyzerDiagnosticConsumer : public ento::PathDiagnosticConsumer {
6263
public:
@@ -669,18 +670,19 @@ getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers) {
669670
Buffer.append(AnalyzerCheck);
670671
Result.Checks.insert(Buffer);
671672
}
672-
for (std::string OptionName : {
673+
674+
static constexpr llvm::StringLiteral OptionNames[] = {
673675
#define GET_CHECKER_OPTIONS
674676
#define CHECKER_OPTION(TYPE, CHECKER, OPTION_NAME, DESCRIPTION, DEFAULT, \
675677
RELEASE, HIDDEN) \
676-
Twine(AnalyzerCheckNamePrefix).concat(CHECKER ":" OPTION_NAME).str(),
678+
ANALYZER_CHECK_NAME_PREFIX CHECKER ":" OPTION_NAME,
677679

678680
#include "clang/StaticAnalyzer/Checkers/Checkers.inc"
679681
#undef CHECKER_OPTION
680682
#undef GET_CHECKER_OPTIONS
681-
}) {
682-
Result.Options.insert(OptionName);
683-
}
683+
};
684+
685+
Result.Options.insert_range(OptionNames);
684686
#endif // CLANG_TIDY_ENABLE_STATIC_ANALYZER
685687

686688
Context.setOptionsCollector(&Result.Options);

clang/Maintainers.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ Clang MLIR generation
5959
| Bruno Cardoso Lopes
6060
| bruno.cardoso\@gmail.com (email), sonicsprawl (Discord), bcardosolopes (GitHub)
6161
62+
| Henrich Lauko
63+
| henrich.lau\@gmail.com (email), henrich.lauko (Discord), xlauko (GitHub)
6264
6365
Analysis & CFG
6466
~~~~~~~~~~~~~~

clang/include/clang/Basic/Attr.td

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,22 @@ def TargetHasDLLImportExport : TargetSpec {
492492
def TargetItaniumCXXABI : TargetSpec {
493493
let CustomCode = [{ Target.getCXXABI().isItaniumFamily() }];
494494
}
495+
495496
def TargetMicrosoftCXXABI : TargetArch<["x86", "x86_64", "arm", "thumb", "aarch64"]> {
496497
let CustomCode = [{ Target.getCXXABI().isMicrosoft() }];
497498
}
499+
500+
// The target follows Microsoft record layout. Usually this happens in two
501+
// cases: 1. the target itself has Microsoft C++ ABI, e.g. x86_64 in MSVC
502+
// environment on Windows 2. an offloading target e.g. amdgcn or nvptx with
503+
// a host target in MSVC environment on Windows.
504+
def TargetMicrosoftRecordLayout : TargetArch<["x86", "x86_64", "arm", "thumb",
505+
"aarch64", "amdgcn", "nvptx",
506+
"nvptx64", "spirv", "spirv32",
507+
"spirv64"]> {
508+
let CustomCode = [{ Target.hasMicrosoftRecordLayout() }];
509+
}
510+
498511
def TargetELF : TargetSpec {
499512
let ObjectFormats = ["ELF"];
500513
}
@@ -1789,7 +1802,7 @@ def Destructor : InheritableAttr {
17891802
let Documentation = [CtorDtorDocs];
17901803
}
17911804

1792-
def EmptyBases : InheritableAttr, TargetSpecificAttr<TargetMicrosoftCXXABI> {
1805+
def EmptyBases : InheritableAttr, TargetSpecificAttr<TargetMicrosoftRecordLayout> {
17931806
let Spellings = [Declspec<"empty_bases">];
17941807
let Subjects = SubjectList<[CXXRecord]>;
17951808
let Documentation = [EmptyBasesDocs];
@@ -2021,7 +2034,7 @@ def Restrict : InheritableAttr {
20212034
let Documentation = [RestrictDocs];
20222035
}
20232036

2024-
def LayoutVersion : InheritableAttr, TargetSpecificAttr<TargetMicrosoftCXXABI> {
2037+
def LayoutVersion : InheritableAttr, TargetSpecificAttr<TargetMicrosoftRecordLayout> {
20252038
let Spellings = [Declspec<"layout_version">];
20262039
let Args = [UnsignedArgument<"Version">];
20272040
let Subjects = SubjectList<[CXXRecord]>;
@@ -2239,7 +2252,7 @@ def NoUniqueAddress : InheritableAttr {
22392252
let Spellings = [CXX11<"", "no_unique_address", 201803>, CXX11<"msvc", "no_unique_address", 201803>];
22402253
let TargetSpecificSpellings = [
22412254
TargetSpecificSpelling<TargetItaniumCXXABI, [CXX11<"", "no_unique_address", 201803>]>,
2242-
TargetSpecificSpelling<TargetMicrosoftCXXABI, [CXX11<"msvc", "no_unique_address", 201803>]>,
2255+
TargetSpecificSpelling<TargetMicrosoftRecordLayout, [CXX11<"msvc", "no_unique_address", 201803>]>,
22432256
];
22442257
let Documentation = [NoUniqueAddressDocs];
22452258
}

clang/include/clang/Basic/BuiltinsSPIRVCL.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ include "clang/Basic/BuiltinsSPIRVBase.td"
1010

1111
def generic_cast_to_ptr_explicit
1212
: SPIRVBuiltin<"void*(void*, int)", [NoThrow, Const, CustomTypeChecking]>;
13+
def global_size : SPIRVBuiltin<"size_t(int)", [NoThrow, Const]>;
14+
def global_offset : SPIRVBuiltin<"size_t(int)", [NoThrow, Const]>;
15+
def subgroup_max_size : SPIRVBuiltin<"uint32_t()", [NoThrow, Const]>;

clang/include/clang/Basic/BuiltinsSPIRVCommon.td

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88

99
include "clang/Basic/BuiltinsSPIRVBase.td"
1010

11+
def num_workgroups : SPIRVBuiltin<"size_t(int)", [NoThrow, Const]>;
12+
def workgroup_size : SPIRVBuiltin<"size_t(int)", [NoThrow, Const]>;
13+
def workgroup_id : SPIRVBuiltin<"size_t(int)", [NoThrow, Const]>;
14+
def local_invocation_id : SPIRVBuiltin<"size_t(int)", [NoThrow, Const]>;
15+
def global_invocation_id : SPIRVBuiltin<"size_t(int)", [NoThrow, Const]>;
16+
def subgroup_size : SPIRVBuiltin<"uint32_t()", [NoThrow, Const]>;
17+
def num_subgroups : SPIRVBuiltin<"uint32_t()", [NoThrow, Const]>;
18+
def subgroup_id : SPIRVBuiltin<"uint32_t()", [NoThrow, Const]>;
19+
def subgroup_local_invocation_id : SPIRVBuiltin<"uint32_t()", [NoThrow, Const]>;
20+
1121
def distance : SPIRVBuiltin<"void(...)", [NoThrow, Const]>;
1222
def length : SPIRVBuiltin<"void(...)", [NoThrow, Const]>;
1323
def smoothstep : SPIRVBuiltin<"void(...)", [NoThrow, Const, CustomTypeChecking]>;

clang/include/clang/Basic/TargetInfo.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ class TargetInfo : public TransferrableTargetInfo,
289289

290290
std::optional<llvm::Triple> DarwinTargetVariantTriple;
291291

292+
bool HasMicrosoftRecordLayout = false;
293+
292294
// TargetInfo Constructor. Default initializes all fields.
293295
TargetInfo(const llvm::Triple &T);
294296

@@ -1331,7 +1333,8 @@ class TargetInfo : public TransferrableTargetInfo,
13311333
/// Apply changes to the target information with respect to certain
13321334
/// language options which change the target configuration and adjust
13331335
/// the language based on the target options where applicable.
1334-
virtual void adjust(DiagnosticsEngine &Diags, LangOptions &Opts);
1336+
virtual void adjust(DiagnosticsEngine &Diags, LangOptions &Opts,
1337+
const TargetInfo *Aux);
13351338

13361339
/// Initialize the map with the default set of target features for the
13371340
/// CPU this should include all legal feature strings on the target.
@@ -1846,6 +1849,8 @@ class TargetInfo : public TransferrableTargetInfo,
18461849

18471850
virtual void setAuxTarget(const TargetInfo *Aux) {}
18481851

1852+
bool hasMicrosoftRecordLayout() const { return HasMicrosoftRecordLayout; }
1853+
18491854
/// Whether target allows debuginfo types for decl only variables/functions.
18501855
virtual bool allowDebugInfoForExternalRef() const { return false; }
18511856

0 commit comments

Comments
 (0)