Skip to content

Commit 915f3ed

Browse files
committed
Merge from 'main' to 'sycl-web' (70 commits)
CONFLICT (content): Merge conflict in clang/include/clang/Basic/AttributeCommonInfo.h CONFLICT (content): Merge conflict in clang/lib/Basic/Attributes.cpp CONFLICT (content): Merge conflict in clang/utils/TableGen/TableGen.cpp
2 parents 76271f1 + 4018317 commit 915f3ed

File tree

329 files changed

+25676
-22937
lines changed

Some content is hidden

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

329 files changed

+25676
-22937
lines changed

clang-tools-extra/modularize/CoverageChecker.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,15 @@ CoverageChecker::collectUmbrellaHeaderHeaders(StringRef UmbrellaHeaderName) {
278278
sys::fs::current_path(PathBuf);
279279

280280
// Create the compilation database.
281-
std::unique_ptr<CompilationDatabase> Compilations;
282-
Compilations.reset(new FixedCompilationDatabase(Twine(PathBuf), CommandLine));
281+
FixedCompilationDatabase Compilations(Twine(PathBuf), CommandLine);
283282

284283
std::vector<std::string> HeaderPath;
285284
HeaderPath.push_back(std::string(UmbrellaHeaderName));
286285

287286
// Create the tool and run the compilation.
288-
ClangTool Tool(*Compilations, HeaderPath);
289-
int HadErrors = Tool.run(new CoverageCheckerFrontendActionFactory(*this));
287+
ClangTool Tool(Compilations, HeaderPath);
288+
CoverageCheckerFrontendActionFactory ActionFactory(*this);
289+
int HadErrors = Tool.run(&ActionFactory);
290290

291291
// If we had errors, exit early.
292292
return !HadErrors;

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,8 @@ Improvements to Clang's diagnostics
807807

808808
- Clang now emits a ``-Wignored-qualifiers`` diagnostic when a base class includes cv-qualifiers (#GH55474).
809809

810+
- Clang now diagnoses the use of attribute names reserved by the C++ standard (#GH92196).
811+
810812
Improvements to Clang's time-trace
811813
----------------------------------
812814

clang/include/clang/Basic/AttributeCommonInfo.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class AttributeCommonInfo {
6161
};
6262
enum Kind {
6363
#define PARSED_ATTR(NAME) AT_##NAME,
64-
#include "clang/Sema/AttrParsedAttrList.inc"
64+
#include "clang/Basic/AttrParsedAttrList.inc"
6565
#undef PARSED_ATTR
6666
NoSemaHandlerAttribute,
6767
IgnoredAttribute,
@@ -81,6 +81,11 @@ class AttributeCommonInfo {
8181
CL,
8282
SYCL_DETAIL
8383
};
84+
enum class AttrArgsInfo {
85+
None,
86+
Optional,
87+
Required,
88+
};
8489

8590
private:
8691
const IdentifierInfo *AttrName = nullptr;
@@ -254,6 +259,8 @@ class AttributeCommonInfo {
254259
static Kind getParsedKind(const IdentifierInfo *Name,
255260
const IdentifierInfo *Scope, Syntax SyntaxUsed);
256261

262+
static AttrArgsInfo getCXX11AttrArgsInfo(const IdentifierInfo *Name);
263+
257264
private:
258265
/// Get an index into the attribute spelling list
259266
/// defined in Attr.td. This index is used by an attribute

clang/include/clang/Basic/Attributes.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ int hasAttribute(AttributeCommonInfo::Syntax Syntax,
2323
const IdentifierInfo *Scope, const IdentifierInfo *Attr,
2424
const TargetInfo &Target, const LangOptions &LangOpts);
2525

26+
int hasAttribute(AttributeCommonInfo::Syntax Syntax,
27+
const IdentifierInfo *Scope, const IdentifierInfo *Attr,
28+
const TargetInfo &Target, const LangOptions &LangOpts,
29+
bool CheckPlugins);
30+
2631
} // end namespace clang
2732

2833
#endif // LLVM_CLANG_BASIC_ATTRIBUTES_H

clang/include/clang/Basic/BuiltinsX86.td

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5191,51 +5191,51 @@ let Features = "avx10.2-512", Attributes = [NoThrow, RequiredVectorWidth<512>] i
51915191
}
51925192

51935193
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
5194-
def vcvtne2ph2bf8_128 : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<8, _Float16>)">;
5194+
def vcvt2ph2bf8_128 : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<8, _Float16>)">;
51955195
}
51965196

51975197
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
5198-
def vcvtne2ph2bf8_256 : X86Builtin<"_Vector<32, char>(_Vector<16, _Float16>, _Vector<16, _Float16>)">;
5198+
def vcvt2ph2bf8_256 : X86Builtin<"_Vector<32, char>(_Vector<16, _Float16>, _Vector<16, _Float16>)">;
51995199
}
52005200

52015201
let Features = "avx10.2-512", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
5202-
def vcvtne2ph2bf8_512 : X86Builtin<"_Vector<64, char>(_Vector<32, _Float16>, _Vector<32, _Float16>)">;
5202+
def vcvt2ph2bf8_512 : X86Builtin<"_Vector<64, char>(_Vector<32, _Float16>, _Vector<32, _Float16>)">;
52035203
}
52045204

52055205
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
5206-
def vcvtne2ph2bf8s_128 : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<8, _Float16>)">;
5206+
def vcvt2ph2bf8s_128 : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<8, _Float16>)">;
52075207
}
52085208

52095209
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
5210-
def vcvtne2ph2bf8s_256 : X86Builtin<"_Vector<32, char>(_Vector<16, _Float16>, _Vector<16, _Float16>)">;
5210+
def vcvt2ph2bf8s_256 : X86Builtin<"_Vector<32, char>(_Vector<16, _Float16>, _Vector<16, _Float16>)">;
52115211
}
52125212

52135213
let Features = "avx10.2-512", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
5214-
def vcvtne2ph2bf8s_512 : X86Builtin<"_Vector<64, char>(_Vector<32, _Float16>, _Vector<32, _Float16>)">;
5214+
def vcvt2ph2bf8s_512 : X86Builtin<"_Vector<64, char>(_Vector<32, _Float16>, _Vector<32, _Float16>)">;
52155215
}
52165216

52175217
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
5218-
def vcvtne2ph2hf8_128 : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<8, _Float16>)">;
5218+
def vcvt2ph2hf8_128 : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<8, _Float16>)">;
52195219
}
52205220

52215221
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
5222-
def vcvtne2ph2hf8_256 : X86Builtin<"_Vector<32, char>(_Vector<16, _Float16>, _Vector<16, _Float16>)">;
5222+
def vcvt2ph2hf8_256 : X86Builtin<"_Vector<32, char>(_Vector<16, _Float16>, _Vector<16, _Float16>)">;
52235223
}
52245224

52255225
let Features = "avx10.2-512", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
5226-
def vcvtne2ph2hf8_512 : X86Builtin<"_Vector<64, char>(_Vector<32, _Float16>, _Vector<32, _Float16>)">;
5226+
def vcvt2ph2hf8_512 : X86Builtin<"_Vector<64, char>(_Vector<32, _Float16>, _Vector<32, _Float16>)">;
52275227
}
52285228

52295229
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
5230-
def vcvtne2ph2hf8s_128 : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<8, _Float16>)">;
5230+
def vcvt2ph2hf8s_128 : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<8, _Float16>)">;
52315231
}
52325232

52335233
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
5234-
def vcvtne2ph2hf8s_256 : X86Builtin<"_Vector<32, char>(_Vector<16, _Float16>, _Vector<16, _Float16>)">;
5234+
def vcvt2ph2hf8s_256 : X86Builtin<"_Vector<32, char>(_Vector<16, _Float16>, _Vector<16, _Float16>)">;
52355235
}
52365236

52375237
let Features = "avx10.2-512", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
5238-
def vcvtne2ph2hf8s_512 : X86Builtin<"_Vector<64, char>(_Vector<32, _Float16>, _Vector<32, _Float16>)">;
5238+
def vcvt2ph2hf8s_512 : X86Builtin<"_Vector<64, char>(_Vector<32, _Float16>, _Vector<32, _Float16>)">;
52395239
}
52405240

52415241
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
@@ -5251,51 +5251,51 @@ let Features = "avx10.2-512", Attributes = [NoThrow, RequiredVectorWidth<512>] i
52515251
}
52525252

52535253
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
5254-
def vcvtneph2bf8_128_mask : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<16, char>, unsigned char)">;
5254+
def vcvtph2bf8_128_mask : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<16, char>, unsigned char)">;
52555255
}
52565256

52575257
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
5258-
def vcvtneph2bf8_256_mask : X86Builtin<"_Vector<16, char>(_Vector<16, _Float16>, _Vector<16, char>, unsigned short)">;
5258+
def vcvtph2bf8_256_mask : X86Builtin<"_Vector<16, char>(_Vector<16, _Float16>, _Vector<16, char>, unsigned short)">;
52595259
}
52605260

52615261
let Features = "avx10.2-512", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
5262-
def vcvtneph2bf8_512_mask : X86Builtin<"_Vector<32, char>(_Vector<32, _Float16>, _Vector<32, char>, unsigned int)">;
5262+
def vcvtph2bf8_512_mask : X86Builtin<"_Vector<32, char>(_Vector<32, _Float16>, _Vector<32, char>, unsigned int)">;
52635263
}
52645264

52655265
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
5266-
def vcvtneph2bf8s_128_mask : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<16, char>, unsigned char)">;
5266+
def vcvtph2bf8s_128_mask : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<16, char>, unsigned char)">;
52675267
}
52685268

52695269
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
5270-
def vcvtneph2bf8s_256_mask : X86Builtin<"_Vector<16, char>(_Vector<16, _Float16>, _Vector<16, char>, unsigned short)">;
5270+
def vcvtph2bf8s_256_mask : X86Builtin<"_Vector<16, char>(_Vector<16, _Float16>, _Vector<16, char>, unsigned short)">;
52715271
}
52725272

52735273
let Features = "avx10.2-512", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
5274-
def vcvtneph2bf8s_512_mask : X86Builtin<"_Vector<32, char>(_Vector<32, _Float16>, _Vector<32, char>, unsigned int)">;
5274+
def vcvtph2bf8s_512_mask : X86Builtin<"_Vector<32, char>(_Vector<32, _Float16>, _Vector<32, char>, unsigned int)">;
52755275
}
52765276

52775277
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
5278-
def vcvtneph2hf8_128_mask : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<16, char>, unsigned char)">;
5278+
def vcvtph2hf8_128_mask : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<16, char>, unsigned char)">;
52795279
}
52805280

52815281
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
5282-
def vcvtneph2hf8_256_mask : X86Builtin<"_Vector<16, char>(_Vector<16, _Float16>, _Vector<16, char>, unsigned short)">;
5282+
def vcvtph2hf8_256_mask : X86Builtin<"_Vector<16, char>(_Vector<16, _Float16>, _Vector<16, char>, unsigned short)">;
52835283
}
52845284

52855285
let Features = "avx10.2-512", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
5286-
def vcvtneph2hf8_512_mask : X86Builtin<"_Vector<32, char>(_Vector<32, _Float16>, _Vector<32, char>, unsigned int)">;
5286+
def vcvtph2hf8_512_mask : X86Builtin<"_Vector<32, char>(_Vector<32, _Float16>, _Vector<32, char>, unsigned int)">;
52875287
}
52885288

52895289
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<128>] in {
5290-
def vcvtneph2hf8s_128_mask : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<16, char>, unsigned char)">;
5290+
def vcvtph2hf8s_128_mask : X86Builtin<"_Vector<16, char>(_Vector<8, _Float16>, _Vector<16, char>, unsigned char)">;
52915291
}
52925292

52935293
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<256>] in {
5294-
def vcvtneph2hf8s_256_mask : X86Builtin<"_Vector<16, char>(_Vector<16, _Float16>, _Vector<16, char>, unsigned short)">;
5294+
def vcvtph2hf8s_256_mask : X86Builtin<"_Vector<16, char>(_Vector<16, _Float16>, _Vector<16, char>, unsigned short)">;
52955295
}
52965296

52975297
let Features = "avx10.2-512", Attributes = [NoThrow, RequiredVectorWidth<512>] in {
5298-
def vcvtneph2hf8s_512_mask : X86Builtin<"_Vector<32, char>(_Vector<32, _Float16>, _Vector<32, char>, unsigned int)">;
5298+
def vcvtph2hf8s_512_mask : X86Builtin<"_Vector<32, char>(_Vector<32, _Float16>, _Vector<32, char>, unsigned int)">;
52995299
}
53005300

53015301
let Features = "avx10.2-256", Attributes = [NoThrow, RequiredVectorWidth<128>] in {

clang/include/clang/Basic/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ clang_tablegen(AttrList.inc -gen-clang-attr-list
3636
SOURCE Attr.td
3737
TARGET ClangAttrList)
3838

39+
clang_tablegen(AttrParsedAttrList.inc -gen-clang-attr-parsed-attr-list
40+
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
41+
SOURCE Attr.td
42+
TARGET ClangAttrParsedAttrList)
43+
3944
clang_tablegen(AttrSubMatchRulesList.inc -gen-clang-attr-subject-match-rule-list
4045
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
4146
SOURCE Attr.td
@@ -53,6 +58,12 @@ clang_tablegen(AttrHasAttributeImpl.inc -gen-clang-attr-has-attribute-impl
5358
TARGET ClangAttrHasAttributeImpl
5459
)
5560

61+
clang_tablegen(CXX11AttributeInfo.inc -gen-cxx11-attribute-info
62+
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
63+
SOURCE Attr.td
64+
TARGET CXX11AttributeInfo
65+
)
66+
5667
clang_tablegen(Builtins.inc -gen-clang-builtins
5768
SOURCE Builtins.td
5869
TARGET ClangBuiltins)

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ def AmbiguousMacro : DiagGroup<"ambiguous-macro">;
764764
def KeywordAsMacro : DiagGroup<"keyword-macro">;
765765
def ReservedIdAsMacro : DiagGroup<"reserved-macro-identifier">;
766766
def ReservedIdAsMacroAlias : DiagGroup<"reserved-id-macro", [ReservedIdAsMacro]>;
767+
def ReservedAttributeIdentifier : DiagGroup<"reserved-attribute-identifier">;
767768
def RestrictExpansionMacro : DiagGroup<"restrict-expansion">;
768769
def FinalMacro : DiagGroup<"final-macro">;
769770

@@ -945,7 +946,8 @@ def SignedEnumBitfield : DiagGroup<"signed-enum-bitfield">;
945946

946947
def ReservedModuleIdentifier : DiagGroup<"reserved-module-identifier">;
947948
def ReservedIdentifier : DiagGroup<"reserved-identifier",
948-
[ReservedIdAsMacro, ReservedModuleIdentifier, UserDefinedLiterals]>;
949+
[ReservedIdAsMacro, ReservedModuleIdentifier,
950+
UserDefinedLiterals, ReservedAttributeIdentifier]>;
949951

950952
// Unreachable code warning groups.
951953
//

clang/include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,9 @@ def warn_pp_macro_hides_keyword : Extension<
407407
def warn_pp_macro_is_reserved_id : Warning<
408408
"macro name is a reserved identifier">, DefaultIgnore,
409409
InGroup<ReservedIdAsMacro>;
410+
def warn_pp_macro_is_reserved_attribute_id : Warning<
411+
"%0 is a reserved attribute identifier">, DefaultIgnore,
412+
InGroup<ReservedAttributeIdentifier>;
410413
def warn_pp_objc_macro_redef_ignored : Warning<
411414
"ignoring redefinition of Objective-C qualifier macro">,
412415
InGroup<DiagGroup<"objc-macro-redefinition">>;

clang/include/clang/Lex/Preprocessor.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,11 @@ class Preprocessor {
22722272
}
22732273
}
22742274

2275+
/// Determine whether the next preprocessor token to be
2276+
/// lexed is a '('. If so, consume the token and return true, if not, this
2277+
/// method should have no observable side-effect on the lexed tokens.
2278+
bool isNextPPTokenLParen();
2279+
22752280
private:
22762281
/// Identifiers used for SEH handling in Borland. These are only
22772282
/// allowed in particular circumstances
@@ -2649,11 +2654,6 @@ class Preprocessor {
26492654

26502655
void removeCachedMacroExpandedTokensOfLastLexer();
26512656

2652-
/// Determine whether the next preprocessor token to be
2653-
/// lexed is a '('. If so, consume the token and return true, if not, this
2654-
/// method should have no observable side-effect on the lexed tokens.
2655-
bool isNextPPTokenLParen();
2656-
26572657
/// After reading "MACRO(", this method is invoked to read all of the formal
26582658
/// arguments specified for the macro invocation. Returns null on error.
26592659
MacroArgs *ReadMacroCallArgumentList(Token &MacroName, MacroInfo *MI,

clang/include/clang/Sema/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ clang_tablegen(AttrTemplateInstantiate.inc -gen-clang-attr-template-instantiate
33
SOURCE ../Basic/Attr.td
44
TARGET ClangAttrTemplateInstantiate)
55

6-
clang_tablegen(AttrParsedAttrList.inc -gen-clang-attr-parsed-attr-list
7-
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
8-
SOURCE ../Basic/Attr.td
9-
TARGET ClangAttrParsedAttrList)
10-
116
clang_tablegen(AttrParsedAttrKinds.inc -gen-clang-attr-parsed-attr-kinds
127
-I ${CMAKE_CURRENT_SOURCE_DIR}/../../
138
SOURCE ../Basic/Attr.td

clang/lib/AST/JSONNodeDumper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,9 +1540,9 @@ void JSONNodeDumper::VisitExprWithCleanups(const ExprWithCleanups *EWC) {
15401540
if (EWC->getNumObjects()) {
15411541
JOS.attributeArray("cleanups", [this, EWC] {
15421542
for (const ExprWithCleanups::CleanupObject &CO : EWC->getObjects())
1543-
if (auto *BD = CO.dyn_cast<BlockDecl *>()) {
1543+
if (auto *BD = dyn_cast<BlockDecl *>(CO)) {
15441544
JOS.value(createBareDeclRef(BD));
1545-
} else if (auto *CLE = CO.dyn_cast<CompoundLiteralExpr *>()) {
1545+
} else if (auto *CLE = dyn_cast<CompoundLiteralExpr *>(CO)) {
15461546
llvm::json::Object Obj;
15471547
Obj["id"] = createPointerRepresentation(CLE);
15481548
Obj["kind"] = CLE->getStmtClassName();

clang/lib/Basic/Attributes.cpp

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ static int hasAttributeImpl(AttributeCommonInfo::Syntax Syntax, StringRef Name,
3131
return 0;
3232
}
3333

34-
int clang::hasAttribute(AttributeCommonInfo::Syntax Syntax, const IdentifierInfo *Scope,
35-
const IdentifierInfo *Attr, const TargetInfo &Target,
36-
const LangOptions &LangOpts) {
34+
int clang::hasAttribute(AttributeCommonInfo::Syntax Syntax,
35+
const IdentifierInfo *Scope, const IdentifierInfo *Attr,
36+
const TargetInfo &Target, const LangOptions &LangOpts,
37+
bool CheckPlugins) {
3738
StringRef ScopeName = Scope ? Scope->getName() : "";
3839
StringRef Name = Attr->getName();
3940
// Normalize the attribute name, __foo__ becomes foo.
@@ -65,14 +66,23 @@ int clang::hasAttribute(AttributeCommonInfo::Syntax Syntax, const IdentifierInfo
6566
if (res)
6667
return res;
6768

68-
// Check if any plugin provides this attribute.
69-
for (auto &Ptr : getAttributePluginInstances())
70-
if (Ptr->hasSpelling(Syntax, Name))
71-
return 1;
69+
if (CheckPlugins) {
70+
// Check if any plugin provides this attribute.
71+
for (auto &Ptr : getAttributePluginInstances())
72+
if (Ptr->hasSpelling(Syntax, Name))
73+
return 1;
74+
}
7275

7376
return 0;
7477
}
7578

79+
int clang::hasAttribute(AttributeCommonInfo::Syntax Syntax,
80+
const IdentifierInfo *Scope, const IdentifierInfo *Attr,
81+
const TargetInfo &Target, const LangOptions &LangOpts) {
82+
return hasAttribute(Syntax, Scope, Attr, Target, LangOpts,
83+
/*CheckPlugins=*/true);
84+
}
85+
7686
const char *attr::getSubjectMatchRuleSpelling(attr::SubjectMatchRule Rule) {
7787
switch (Rule) {
7888
#define ATTR_MATCH_RULE(NAME, SPELLING, IsAbstract) \
@@ -155,6 +165,17 @@ AttributeCommonInfo::getParsedKind(const IdentifierInfo *Name,
155165
return ::getAttrKind(normalizeName(Name, ScopeName, SyntaxUsed), SyntaxUsed);
156166
}
157167

168+
AttributeCommonInfo::AttrArgsInfo
169+
AttributeCommonInfo::getCXX11AttrArgsInfo(const IdentifierInfo *Name) {
170+
StringRef AttrName =
171+
normalizeAttrName(Name, /*NormalizedScopeName*/ "", Syntax::AS_CXX11);
172+
#define CXX11_ATTR_ARGS_INFO
173+
return llvm::StringSwitch<AttributeCommonInfo::AttrArgsInfo>(AttrName)
174+
#include "clang/Basic/CXX11AttributeInfo.inc"
175+
.Default(AttributeCommonInfo::AttrArgsInfo::None);
176+
#undef CXX11_ATTR_ARGS_INFO
177+
}
178+
158179
std::string AttributeCommonInfo::getNormalizedFullName() const {
159180
return static_cast<std::string>(
160181
normalizeName(getAttrName(), getScopeName(), getSyntax()));

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4079,7 +4079,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
40794079
Size = llvm::ConstantInt::get(CGF.SizeTy, 0);
40804080
}
40814081
LValue Base;
4082-
if (unsigned *P = Pos.dyn_cast<unsigned *>()) {
4082+
if (unsigned *P = dyn_cast<unsigned *>(Pos)) {
40834083
Base = CGF.MakeAddrLValue(
40844084
CGF.Builder.CreateConstGEP(DependenciesArray, *P), KmpDependInfoTy);
40854085
} else {
@@ -4109,7 +4109,7 @@ static void emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
41094109
CGF.EmitStoreOfScalar(
41104110
llvm::ConstantInt::get(LLVMFlagsTy, static_cast<unsigned int>(DepKind)),
41114111
FlagsLVal);
4112-
if (unsigned *P = Pos.dyn_cast<unsigned *>()) {
4112+
if (unsigned *P = dyn_cast<unsigned *>(Pos)) {
41134113
++(*P);
41144114
} else {
41154115
LValue &PosLVal = *cast<LValue *>(Pos);

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6875,9 +6875,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
68756875
CmdArgs.push_back("-fno-direct-access-external-data");
68766876
}
68776877

6878-
if (Args.hasFlag(options::OPT_fno_plt, options::OPT_fplt, false)) {
6879-
CmdArgs.push_back("-fno-plt");
6880-
}
6878+
if (Triple.isOSBinFormatELF() && (Triple.isAArch64() || Triple.isX86()))
6879+
Args.addOptOutFlag(CmdArgs, options::OPT_fplt, options::OPT_fno_plt);
68816880

68826881
// -fhosted is default.
68836882
// TODO: Audit uses of KernelOrKext and see where it'd be more appropriate to

0 commit comments

Comments
 (0)