Skip to content

Commit 94d4162

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:22138720020d into origin/amd-gfx:b04ccdbe3eb1
Local branch origin/amd-gfx b04ccdb Merged main:c4bc1b1d8177 into origin/amd-gfx:23e6bf1399b8 Remote branch main 2213872 llvm-reduce: Use isCallee helper (llvm#133419)
2 parents b04ccdb + 2213872 commit 94d4162

File tree

112 files changed

+2154
-1074
lines changed

Some content is hidden

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

112 files changed

+2154
-1074
lines changed

bolt/include/bolt/Core/Relocation.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ class Relocation {
5757
uint32_t Type;
5858

5959
private:
60-
/// Relocations added by optimizations can be optional.
60+
/// Relocations added by optimizations can be optional, meaning they can be
61+
/// omitted under certain circumstances.
6162
bool Optional = false;
6263

6364
public:
@@ -72,10 +73,10 @@ class Relocation {
7273
/// Return size in bytes of the given relocation \p Type.
7374
static size_t getSizeForType(uint32_t Type);
7475

75-
/// Some relocations added by optimizations are optional, meaning they can be
76-
/// omitted under certain circumstances.
7776
void setOptional() { Optional = true; }
7877

78+
bool isOptional() { return Optional; }
79+
7980
/// Return size of this relocation.
8081
size_t getSize() const { return getSizeForType(Type); }
8182

clang-tools-extra/clang-tidy/misc/UseInternalLinkageCheck.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ void UseInternalLinkageCheck::registerMatchers(MatchFinder *Finder) {
130130
isMain())))
131131
.bind("fn"),
132132
this);
133-
Finder->addMatcher(varDecl(Common, hasGlobalStorage()).bind("var"), this);
133+
Finder->addMatcher(
134+
varDecl(Common, hasGlobalStorage(), unless(hasThreadStorageDuration()))
135+
.bind("var"),
136+
this);
134137
}
135138

136139
static constexpr StringRef Message =

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ Changes in existing checks
159159

160160
- Improved :doc:`misc-use-internal-linkage
161161
<clang-tidy/checks/misc/use-internal-linkage>` check by fix false positives
162-
for function or variable in header file which contains macro expansion.
162+
for function or variable in header file which contains macro expansion and
163+
excluding variables with ``thread_local`` storage class specifier from being
164+
matched.
163165

164166
- Improved :doc:`modernize-use-default-member-init
165167
<clang-tidy/checks/modernize/use-default-member-init>` check by matching

clang-tools-extra/docs/clang-tidy/checks/bugprone/argument-comment.rst

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ Options
2424

2525
.. option:: StrictMode
2626

27-
When `false` (default value), the check will ignore leading and trailing
27+
When `false`, the check will ignore leading and trailing
2828
underscores and case when comparing names -- otherwise they are taken into
29-
account.
29+
account. Default is `false`.
3030

3131
.. option:: IgnoreSingleArgument
3232

33-
When `true`, the check will ignore the single argument.
33+
When `true`, the check will ignore the single argument. Default is `false`.
3434

3535
.. option:: CommentBoolLiterals
3636

3737
When `true`, the check will add argument comments in the format
3838
``/*ParameterName=*/`` right before the boolean literal argument.
39+
Default is `false`.
3940

4041
Before:
4142

@@ -55,8 +56,9 @@ After:
5556

5657
.. option:: CommentIntegerLiterals
5758

58-
When true, the check will add argument comments in the format
59+
When `true`, the check will add argument comments in the format
5960
``/*ParameterName=*/`` right before the integer literal argument.
61+
Default is `false`.
6062

6163
Before:
6264

@@ -76,8 +78,9 @@ After:
7678

7779
.. option:: CommentFloatLiterals
7880

79-
When true, the check will add argument comments in the format
81+
When `true`, the check will add argument comments in the format
8082
``/*ParameterName=*/`` right before the float/double literal argument.
83+
Default is `false`.
8184

8285
Before:
8386

@@ -97,8 +100,9 @@ After:
97100

98101
.. option:: CommentStringLiterals
99102

100-
When true, the check will add argument comments in the format
103+
When `true`, the check will add argument comments in the format
101104
``/*ParameterName=*/`` right before the string literal argument.
105+
Default is `false`.
102106

103107
Before:
104108

@@ -122,8 +126,9 @@ After:
122126

123127
.. option:: CommentCharacterLiterals
124128

125-
When true, the check will add argument comments in the format
129+
When `true`, the check will add argument comments in the format
126130
``/*ParameterName=*/`` right before the character literal argument.
131+
Default is `false`.
127132

128133
Before:
129134

@@ -143,8 +148,9 @@ After:
143148

144149
.. option:: CommentUserDefinedLiterals
145150

146-
When true, the check will add argument comments in the format
151+
When `true`, the check will add argument comments in the format
147152
``/*ParameterName=*/`` right before the user defined literal argument.
153+
Default is `false`.
148154

149155
Before:
150156

@@ -168,8 +174,9 @@ After:
168174

169175
.. option:: CommentNullPtrs
170176

171-
When true, the check will add argument comments in the format
177+
When `true`, the check will add argument comments in the format
172178
``/*ParameterName=*/`` right before the nullptr literal argument.
179+
Default is `false`.
173180

174181
Before:
175182

clang-tools-extra/test/clang-tidy/checkers/misc/use-internal-linkage-var.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ extern int global_extern;
3131

3232
static int global_static;
3333

34+
thread_local int global_thread_local;
35+
3436
namespace {
3537
static int global_anonymous_ns;
3638
namespace NS {
@@ -41,6 +43,7 @@ static int global_anonymous_ns;
4143
static void f(int para) {
4244
int local;
4345
static int local_static;
46+
thread_local int local_thread_local;
4447
}
4548

4649
struct S {

clang/include/clang/Basic/LangOptions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,11 @@ class LangOptions : public LangOptionsBase {
838838
return FPExceptionModeKind::FPE_Ignore;
839839
return EM;
840840
}
841+
842+
/// True when compiling for an offloading target device.
843+
bool isTargetDevice() const {
844+
return OpenMPIsTargetDevice || CUDAIsDevice || SYCLIsDevice;
845+
}
841846
};
842847

843848
/// Floating point control options

clang/include/clang/Driver/ToolChain.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,9 @@ class ToolChain {
519519
StringRef Component,
520520
FileType Type = ToolChain::FT_Static) const;
521521

522+
// Returns Triple without the OSs version.
523+
llvm::Triple getTripleWithoutOSVersion() const;
524+
522525
// Returns the target specific runtime path if it exists.
523526
std::optional<std::string> getRuntimePath() const;
524527

clang/include/clang/Serialization/ASTDeserializationListener.h

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class MacroInfo;
2727
class Module;
2828
class SourceLocation;
2929

30+
// IMPORTANT: when you add a new interface to this class, please update the
31+
// DelegatingDeserializationListener below.
3032
class ASTDeserializationListener {
3133
public:
3234
virtual ~ASTDeserializationListener();
@@ -44,6 +46,11 @@ class ASTDeserializationListener {
4446
/// unqualified.
4547
virtual void TypeRead(serialization::TypeIdx Idx, QualType T) { }
4648
/// A decl was deserialized from the AST file.
49+
//
50+
// Note: Implementors should be cautious when introducing additional
51+
// serialization (e.g., printing the qualified name of the declaration) within
52+
// the callback. Doing so may lead to unintended and complex side effects, or
53+
// even cause a crash.
4754
virtual void DeclRead(GlobalDeclID ID, const Decl *D) {}
4855
/// A predefined decl was built during the serialization.
4956
virtual void PredefinedDeclBuilt(PredefinedDeclIDs ID, const Decl *D) {}
@@ -58,6 +65,70 @@ class ASTDeserializationListener {
5865
virtual void ModuleImportRead(serialization::SubmoduleID ID,
5966
SourceLocation ImportLoc) {}
6067
};
61-
}
68+
69+
class DelegatingDeserializationListener : public ASTDeserializationListener {
70+
ASTDeserializationListener *Previous;
71+
bool DeletePrevious;
72+
73+
public:
74+
explicit DelegatingDeserializationListener(
75+
ASTDeserializationListener *Previous, bool DeletePrevious)
76+
: Previous(Previous), DeletePrevious(DeletePrevious) {}
77+
~DelegatingDeserializationListener() override {
78+
if (DeletePrevious)
79+
delete Previous;
80+
}
81+
82+
DelegatingDeserializationListener(const DelegatingDeserializationListener &) =
83+
delete;
84+
DelegatingDeserializationListener &
85+
operator=(const DelegatingDeserializationListener &) = delete;
86+
87+
void ReaderInitialized(ASTReader *Reader) override {
88+
if (Previous)
89+
Previous->ReaderInitialized(Reader);
90+
}
91+
void IdentifierRead(serialization::IdentifierID ID,
92+
IdentifierInfo *II) override {
93+
if (Previous)
94+
Previous->IdentifierRead(ID, II);
95+
}
96+
void MacroRead(serialization::MacroID ID, MacroInfo *MI) override {
97+
if (Previous)
98+
Previous->MacroRead(ID, MI);
99+
}
100+
void TypeRead(serialization::TypeIdx Idx, QualType T) override {
101+
if (Previous)
102+
Previous->TypeRead(Idx, T);
103+
}
104+
void DeclRead(GlobalDeclID ID, const Decl *D) override {
105+
if (Previous)
106+
Previous->DeclRead(ID, D);
107+
}
108+
void PredefinedDeclBuilt(PredefinedDeclIDs ID, const Decl *D) override {
109+
if (Previous)
110+
Previous->PredefinedDeclBuilt(ID, D);
111+
}
112+
void SelectorRead(serialization::SelectorID ID, Selector Sel) override {
113+
if (Previous)
114+
Previous->SelectorRead(ID, Sel);
115+
}
116+
void MacroDefinitionRead(serialization::PreprocessedEntityID PPID,
117+
MacroDefinitionRecord *MD) override {
118+
if (Previous)
119+
Previous->MacroDefinitionRead(PPID, MD);
120+
}
121+
void ModuleRead(serialization::SubmoduleID ID, Module *Mod) override {
122+
if (Previous)
123+
Previous->ModuleRead(ID, Mod);
124+
}
125+
void ModuleImportRead(serialization::SubmoduleID ID,
126+
SourceLocation ImportLoc) override {
127+
if (Previous)
128+
Previous->ModuleImportRead(ID, ImportLoc);
129+
}
130+
};
131+
132+
} // namespace clang
62133

63134
#endif

clang/lib/AST/Decl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,8 +810,7 @@ LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl *D,
810810
// functions as the host-callable kernel functions are emitted at codegen.
811811
if (Context.getLangOpts().OpenMP &&
812812
Context.getLangOpts().OpenMPIsTargetDevice &&
813-
((Context.getTargetInfo().getTriple().isAMDGPU() ||
814-
Context.getTargetInfo().getTriple().isNVPTX()) ||
813+
(Context.getTargetInfo().getTriple().isGPU() ||
815814
OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(Function)))
816815
LV.mergeVisibility(HiddenVisibility, /*newExplicit=*/false);
817816

clang/lib/Basic/Targets/SPIR.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void SPIR64TargetInfo::getTargetDefines(const LangOptions &Opts,
5959
void BaseSPIRVTargetInfo::getTargetDefines(const LangOptions &Opts,
6060
MacroBuilder &Builder) const {
6161
DefineStd(Builder, "SPIRV", Opts);
62+
DefineStd(Builder, "spirv", Opts);
6263
}
6364

6465
void SPIRVTargetInfo::getTargetDefines(const LangOptions &Opts,

0 commit comments

Comments
 (0)