summaryrefslogtreecommitdiff
path: root/include/clang/Sema
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2019-09-13 17:39:31 +0000
committerErich Keane <erich.keane@intel.com>2019-09-13 17:39:31 +0000
commit063c2472faf6c009cbff5853273c9eff14cb9160 (patch)
tree16f876986d482ea80afe5900f9ffd168aeeb61c1 /include/clang/Sema
parentff6d4b99884f00b21ab70231801f8b156f5d738a (diff)
downloadclang-063c2472faf6c009cbff5853273c9eff14cb9160.tar.gz
[NFCI]Create CommonAttributeInfo Type as base type of *Attr and ParsedAttr.
In order to enable future improvements to our attribute diagnostics, this moves info from ParsedAttr into CommonAttributeInfo, then makes this type the base of the *Attr and ParsedAttr types. Quite a bit of refactoring took place, including removing a bunch of redundant Spelling Index propogation. Differential Revision: https://reviews.llvm.org/D67368 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371875 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Sema')
-rw-r--r--include/clang/Sema/ParsedAttr.h212
-rw-r--r--include/clang/Sema/Sema.h103
2 files changed, 114 insertions, 201 deletions
diff --git a/include/clang/Sema/ParsedAttr.h b/include/clang/Sema/ParsedAttr.h
index d87d5da04a..d9d8585970 100644
--- a/include/clang/Sema/ParsedAttr.h
+++ b/include/clang/Sema/ParsedAttr.h
@@ -15,6 +15,7 @@
#define LLVM_CLANG_SEMA_ATTRIBUTELIST_H
#include "clang/Basic/AttrSubjectMatchRules.h"
+#include "clang/Basic/AttributeCommonInfo.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/TargetInfo.h"
@@ -114,7 +115,8 @@ using ArgsVector = llvm::SmallVector<ArgsUnion, 12U>;
/// 4: __attribute__(( aligned(16) )). ParmName is unused, Args/Num used.
///
class ParsedAttr final
- : private llvm::TrailingObjects<
+ : public AttributeCommonInfo,
+ private llvm::TrailingObjects<
ParsedAttr, ArgsUnion, detail::AvailabilityData,
detail::TypeTagForDatatypeData, ParsedType, detail::PropertyData> {
friend TrailingObjects;
@@ -134,54 +136,15 @@ class ParsedAttr final
return IsProperty;
}
-public:
- /// The style used to specify an attribute.
- enum Syntax {
- /// __attribute__((...))
- AS_GNU,
-
- /// [[...]]
- AS_CXX11,
-
- /// [[...]]
- AS_C2x,
-
- /// __declspec(...)
- AS_Declspec,
-
- /// [uuid("...")] class Foo
- AS_Microsoft,
-
- /// __ptr16, alignas(...), etc.
- AS_Keyword,
-
- /// #pragma ...
- AS_Pragma,
-
- // Note TableGen depends on the order above. Do not add or change the order
- // without adding related code to TableGen/ClangAttrEmitter.cpp.
- /// Context-sensitive version of a keyword attribute.
- AS_ContextSensitiveKeyword,
- };
-
private:
- IdentifierInfo *AttrName;
- IdentifierInfo *ScopeName;
IdentifierInfo *MacroII = nullptr;
SourceLocation MacroExpansionLoc;
- SourceRange AttrRange;
- SourceLocation ScopeLoc;
SourceLocation EllipsisLoc;
- unsigned AttrKind : 16;
-
/// The number of expression arguments this attribute has.
/// The expressions themselves are stored after the object.
unsigned NumArgs : 16;
- /// Corresponds to the Syntax enum.
- unsigned SyntaxUsed : 3;
-
/// True if already diagnosed as invalid.
mutable unsigned Invalid : 1;
@@ -239,14 +202,14 @@ private:
IdentifierInfo *scopeName, SourceLocation scopeLoc,
ArgsUnion *args, unsigned numArgs, Syntax syntaxUsed,
SourceLocation ellipsisLoc)
- : AttrName(attrName), ScopeName(scopeName), AttrRange(attrRange),
- ScopeLoc(scopeLoc), EllipsisLoc(ellipsisLoc), NumArgs(numArgs),
- SyntaxUsed(syntaxUsed), Invalid(false), UsedAsTypeAttr(false),
- IsAvailability(false), IsTypeTagForDatatype(false), IsProperty(false),
- HasParsedType(false), HasProcessingCache(false),
- IsPragmaClangAttribute(false) {
- if (numArgs) memcpy(getArgsBuffer(), args, numArgs * sizeof(ArgsUnion));
- AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
+ : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
+ syntaxUsed),
+ EllipsisLoc(ellipsisLoc), NumArgs(numArgs), Invalid(false),
+ UsedAsTypeAttr(false), IsAvailability(false),
+ IsTypeTagForDatatype(false), IsProperty(false), HasParsedType(false),
+ HasProcessingCache(false), IsPragmaClangAttribute(false) {
+ if (numArgs)
+ memcpy(getArgsBuffer(), args, numArgs * sizeof(ArgsUnion));
}
/// Constructor for availability attributes.
@@ -257,9 +220,9 @@ private:
const AvailabilityChange &obsoleted, SourceLocation unavailable,
const Expr *messageExpr, Syntax syntaxUsed, SourceLocation strict,
const Expr *replacementExpr)
- : AttrName(attrName), ScopeName(scopeName), AttrRange(attrRange),
- ScopeLoc(scopeLoc), NumArgs(1), SyntaxUsed(syntaxUsed), Invalid(false),
- UsedAsTypeAttr(false), IsAvailability(true),
+ : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
+ syntaxUsed),
+ NumArgs(1), Invalid(false), UsedAsTypeAttr(false), IsAvailability(true),
IsTypeTagForDatatype(false), IsProperty(false), HasParsedType(false),
HasProcessingCache(false), IsPragmaClangAttribute(false),
UnavailableLoc(unavailable), MessageExpr(messageExpr) {
@@ -267,7 +230,6 @@ private:
memcpy(getArgsBuffer(), &PVal, sizeof(ArgsUnion));
new (getAvailabilityData()) detail::AvailabilityData(
introduced, deprecated, obsoleted, strict, replacementExpr);
- AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
}
/// Constructor for objc_bridge_related attributes.
@@ -275,16 +237,16 @@ private:
IdentifierInfo *scopeName, SourceLocation scopeLoc,
IdentifierLoc *Parm1, IdentifierLoc *Parm2, IdentifierLoc *Parm3,
Syntax syntaxUsed)
- : AttrName(attrName), ScopeName(scopeName), AttrRange(attrRange),
- ScopeLoc(scopeLoc), NumArgs(3), SyntaxUsed(syntaxUsed), Invalid(false),
- UsedAsTypeAttr(false), IsAvailability(false),
- IsTypeTagForDatatype(false), IsProperty(false), HasParsedType(false),
- HasProcessingCache(false), IsPragmaClangAttribute(false) {
+ : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
+ syntaxUsed),
+ NumArgs(3), Invalid(false), UsedAsTypeAttr(false),
+ IsAvailability(false), IsTypeTagForDatatype(false), IsProperty(false),
+ HasParsedType(false), HasProcessingCache(false),
+ IsPragmaClangAttribute(false) {
ArgsUnion *Args = getArgsBuffer();
Args[0] = Parm1;
Args[1] = Parm2;
Args[2] = Parm3;
- AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
}
/// Constructor for type_tag_for_datatype attribute.
@@ -292,31 +254,31 @@ private:
IdentifierInfo *scopeName, SourceLocation scopeLoc,
IdentifierLoc *ArgKind, ParsedType matchingCType,
bool layoutCompatible, bool mustBeNull, Syntax syntaxUsed)
- : AttrName(attrName), ScopeName(scopeName), AttrRange(attrRange),
- ScopeLoc(scopeLoc), NumArgs(1), SyntaxUsed(syntaxUsed), Invalid(false),
- UsedAsTypeAttr(false), IsAvailability(false),
- IsTypeTagForDatatype(true), IsProperty(false), HasParsedType(false),
- HasProcessingCache(false), IsPragmaClangAttribute(false) {
+ : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
+ syntaxUsed),
+ NumArgs(1), Invalid(false), UsedAsTypeAttr(false),
+ IsAvailability(false), IsTypeTagForDatatype(true), IsProperty(false),
+ HasParsedType(false), HasProcessingCache(false),
+ IsPragmaClangAttribute(false) {
ArgsUnion PVal(ArgKind);
memcpy(getArgsBuffer(), &PVal, sizeof(ArgsUnion));
detail::TypeTagForDatatypeData &ExtraData = getTypeTagForDatatypeDataSlot();
new (&ExtraData.MatchingCType) ParsedType(matchingCType);
ExtraData.LayoutCompatible = layoutCompatible;
ExtraData.MustBeNull = mustBeNull;
- AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
}
/// Constructor for attributes with a single type argument.
ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
IdentifierInfo *scopeName, SourceLocation scopeLoc,
ParsedType typeArg, Syntax syntaxUsed)
- : AttrName(attrName), ScopeName(scopeName), AttrRange(attrRange),
- ScopeLoc(scopeLoc), NumArgs(0), SyntaxUsed(syntaxUsed), Invalid(false),
- UsedAsTypeAttr(false), IsAvailability(false),
- IsTypeTagForDatatype(false), IsProperty(false), HasParsedType(true),
- HasProcessingCache(false), IsPragmaClangAttribute(false) {
+ : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
+ syntaxUsed),
+ NumArgs(0), Invalid(false), UsedAsTypeAttr(false),
+ IsAvailability(false), IsTypeTagForDatatype(false), IsProperty(false),
+ HasParsedType(true), HasProcessingCache(false),
+ IsPragmaClangAttribute(false) {
new (&getTypeBuffer()) ParsedType(typeArg);
- AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
}
/// Constructor for microsoft __declspec(property) attribute.
@@ -324,13 +286,13 @@ private:
IdentifierInfo *scopeName, SourceLocation scopeLoc,
IdentifierInfo *getterId, IdentifierInfo *setterId,
Syntax syntaxUsed)
- : AttrName(attrName), ScopeName(scopeName), AttrRange(attrRange),
- ScopeLoc(scopeLoc), NumArgs(0), SyntaxUsed(syntaxUsed), Invalid(false),
- UsedAsTypeAttr(false), IsAvailability(false),
- IsTypeTagForDatatype(false), IsProperty(true), HasParsedType(false),
- HasProcessingCache(false), IsPragmaClangAttribute(false) {
+ : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
+ syntaxUsed),
+ NumArgs(0), Invalid(false), UsedAsTypeAttr(false),
+ IsAvailability(false), IsTypeTagForDatatype(false), IsProperty(true),
+ HasParsedType(false), HasProcessingCache(false),
+ IsPragmaClangAttribute(false) {
new (&getPropertyDataBuffer()) detail::PropertyData(getterId, setterId);
- AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
}
/// Type tag information is stored immediately following the arguments, if
@@ -372,27 +334,6 @@ public:
void operator delete(void *) = delete;
- enum Kind {
- #define PARSED_ATTR(NAME) AT_##NAME,
- #include "clang/Sema/AttrParsedAttrList.inc"
- #undef PARSED_ATTR
- IgnoredAttribute,
- UnknownAttribute
- };
-
- IdentifierInfo *getName() const { return AttrName; }
- SourceLocation getLoc() const { return AttrRange.getBegin(); }
- SourceRange getRange() const { return AttrRange; }
-
- bool hasScope() const { return ScopeName; }
- IdentifierInfo *getScopeName() const { return ScopeName; }
- SourceLocation getScopeLoc() const { return ScopeLoc; }
-
- bool isGNUScope() const {
- return ScopeName &&
- (ScopeName->isStr("gnu") || ScopeName->isStr("__gnu__"));
- }
-
bool hasParsedType() const { return HasParsedType; }
/// Is this the Microsoft __declspec(property) attribute?
@@ -400,30 +341,6 @@ public:
return IsProperty;
}
- bool isAlignasAttribute() const {
- // FIXME: Use a better mechanism to determine this.
- return getKind() == AT_Aligned && isKeywordAttribute();
- }
-
- bool isDeclspecAttribute() const { return SyntaxUsed == AS_Declspec; }
- bool isMicrosoftAttribute() const { return SyntaxUsed == AS_Microsoft; }
-
- bool isCXX11Attribute() const {
- return SyntaxUsed == AS_CXX11 || isAlignasAttribute();
- }
-
- bool isC2xAttribute() const {
- return SyntaxUsed == AS_C2x;
- }
-
- bool isKeywordAttribute() const {
- return SyntaxUsed == AS_Keyword || SyntaxUsed == AS_ContextSensitiveKeyword;
- }
-
- bool isContextSensitiveKeywordAttribute() const {
- return SyntaxUsed == AS_ContextSensitiveKeyword;
- }
-
bool isInvalid() const { return Invalid; }
void setInvalid(bool b = true) const { Invalid = b; }
@@ -450,10 +367,6 @@ public:
bool isPackExpansion() const { return EllipsisLoc.isValid(); }
SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
- Kind getKind() const { return Kind(AttrKind); }
- static Kind getKind(const IdentifierInfo *Name, const IdentifierInfo *Scope,
- Syntax SyntaxUsed);
-
/// getNumArgs - Return the number of actual arguments to this attribute.
unsigned getNumArgs() const { return NumArgs; }
@@ -480,54 +393,61 @@ public:
}
const AvailabilityChange &getAvailabilityIntroduced() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getParsedKind() == AT_Availability &&
+ "Not an availability attribute");
return getAvailabilityData()->Changes[detail::IntroducedSlot];
}
const AvailabilityChange &getAvailabilityDeprecated() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getParsedKind() == AT_Availability &&
+ "Not an availability attribute");
return getAvailabilityData()->Changes[detail::DeprecatedSlot];
}
const AvailabilityChange &getAvailabilityObsoleted() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getParsedKind() == AT_Availability &&
+ "Not an availability attribute");
return getAvailabilityData()->Changes[detail::ObsoletedSlot];
}
SourceLocation getStrictLoc() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getParsedKind() == AT_Availability &&
+ "Not an availability attribute");
return getAvailabilityData()->StrictLoc;
}
SourceLocation getUnavailableLoc() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getParsedKind() == AT_Availability &&
+ "Not an availability attribute");
return UnavailableLoc;
}
const Expr * getMessageExpr() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getParsedKind() == AT_Availability &&
+ "Not an availability attribute");
return MessageExpr;
}
const Expr *getReplacementExpr() const {
- assert(getKind() == AT_Availability && "Not an availability attribute");
+ assert(getParsedKind() == AT_Availability &&
+ "Not an availability attribute");
return getAvailabilityData()->Replacement;
}
const ParsedType &getMatchingCType() const {
- assert(getKind() == AT_TypeTagForDatatype &&
+ assert(getParsedKind() == AT_TypeTagForDatatype &&
"Not a type_tag_for_datatype attribute");
return getTypeTagForDatatypeDataSlot().MatchingCType;
}
bool getLayoutCompatible() const {
- assert(getKind() == AT_TypeTagForDatatype &&
+ assert(getParsedKind() == AT_TypeTagForDatatype &&
"Not a type_tag_for_datatype attribute");
return getTypeTagForDatatypeDataSlot().LayoutCompatible;
}
bool getMustBeNull() const {
- assert(getKind() == AT_TypeTagForDatatype &&
+ assert(getParsedKind() == AT_TypeTagForDatatype &&
"Not a type_tag_for_datatype attribute");
return getTypeTagForDatatypeDataSlot().MustBeNull;
}
@@ -570,11 +490,6 @@ public:
return MacroExpansionLoc;
}
- /// Get an index into the attribute spelling list
- /// defined in Attr.td. This index is used by an attribute
- /// to pretty print itself.
- unsigned getAttributeSpellingListIndex() const;
-
bool isTargetSpecificAttr() const;
bool isTypeAttr() const;
bool isStmtAttr() const;
@@ -603,7 +518,7 @@ public:
/// If this is an OpenCL addr space attribute returns its representation
/// in LangAS, otherwise returns default addr space.
LangAS asOpenCLLangAS() const {
- switch (getKind()) {
+ switch (getParsedKind()) {
case ParsedAttr::AT_OpenCLConstantAddressSpace:
return LangAS::opencl_constant;
case ParsedAttr::AT_OpenCLGlobalAddressSpace:
@@ -618,6 +533,8 @@ public:
return LangAS::Default;
}
}
+
+ AttributeCommonInfo::Kind getKind() const { return getParsedKind(); }
};
class AttributePool;
@@ -889,8 +806,9 @@ public:
}
bool hasAttribute(ParsedAttr::Kind K) const {
- return llvm::any_of(
- AttrList, [K](const ParsedAttr *AL) { return AL->getKind() == K; });
+ return llvm::any_of(AttrList, [K](const ParsedAttr *AL) {
+ return AL->getParsedKind() == K;
+ });
}
private:
@@ -1038,28 +956,28 @@ enum AttributeDeclKind {
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
const ParsedAttr &At) {
- DB.AddTaggedVal(reinterpret_cast<intptr_t>(At.getName()),
+ DB.AddTaggedVal(reinterpret_cast<intptr_t>(At.getAttrName()),
DiagnosticsEngine::ak_identifierinfo);
return DB;
}
inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
const ParsedAttr &At) {
- PD.AddTaggedVal(reinterpret_cast<intptr_t>(At.getName()),
+ PD.AddTaggedVal(reinterpret_cast<intptr_t>(At.getAttrName()),
DiagnosticsEngine::ak_identifierinfo);
return PD;
}
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
const ParsedAttr *At) {
- DB.AddTaggedVal(reinterpret_cast<intptr_t>(At->getName()),
+ DB.AddTaggedVal(reinterpret_cast<intptr_t>(At->getAttrName()),
DiagnosticsEngine::ak_identifierinfo);
return DB;
}
inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
const ParsedAttr *At) {
- PD.AddTaggedVal(reinterpret_cast<intptr_t>(At->getName()),
+ PD.AddTaggedVal(reinterpret_cast<intptr_t>(At->getAttrName()),
DiagnosticsEngine::ak_identifierinfo);
return PD;
}
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 59f16da8f3..59b1d9c3e4 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -2665,48 +2665,44 @@ public:
};
/// Attribute merging methods. Return true if a new attribute was added.
- AvailabilityAttr *mergeAvailabilityAttr(
- NamedDecl *D, SourceRange Range, IdentifierInfo *Platform, bool Implicit,
- VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted,
- bool IsUnavailable, StringRef Message, bool IsStrict,
- StringRef Replacement, AvailabilityMergeKind AMK, int Priority,
- unsigned AttrSpellingListIndex);
- TypeVisibilityAttr *mergeTypeVisibilityAttr(Decl *D, SourceRange Range,
- TypeVisibilityAttr::VisibilityType Vis,
- unsigned AttrSpellingListIndex);
- VisibilityAttr *mergeVisibilityAttr(Decl *D, SourceRange Range,
- VisibilityAttr::VisibilityType Vis,
- unsigned AttrSpellingListIndex);
- UuidAttr *mergeUuidAttr(Decl *D, SourceRange Range,
- unsigned AttrSpellingListIndex, StringRef Uuid);
- DLLImportAttr *mergeDLLImportAttr(Decl *D, SourceRange Range,
- unsigned AttrSpellingListIndex);
- DLLExportAttr *mergeDLLExportAttr(Decl *D, SourceRange Range,
- unsigned AttrSpellingListIndex);
+ AvailabilityAttr *
+ mergeAvailabilityAttr(NamedDecl *D, const AttributeCommonInfo &CI,
+ IdentifierInfo *Platform, bool Implicit,
+ VersionTuple Introduced, VersionTuple Deprecated,
+ VersionTuple Obsoleted, bool IsUnavailable,
+ StringRef Message, bool IsStrict, StringRef Replacement,
+ AvailabilityMergeKind AMK, int Priority);
+ TypeVisibilityAttr *
+ mergeTypeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI,
+ TypeVisibilityAttr::VisibilityType Vis);
+ VisibilityAttr *mergeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI,
+ VisibilityAttr::VisibilityType Vis);
+ UuidAttr *mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI,
+ StringRef Uuid);
+ DLLImportAttr *mergeDLLImportAttr(Decl *D, const AttributeCommonInfo &CI);
+ DLLExportAttr *mergeDLLExportAttr(Decl *D, const AttributeCommonInfo &CI);
MSInheritanceAttr *
- mergeMSInheritanceAttr(Decl *D, SourceRange Range, bool BestCase,
- unsigned AttrSpellingListIndex,
+ mergeMSInheritanceAttr(Decl *D, const AttributeCommonInfo &CI, bool BestCase,
MSInheritanceAttr::Spelling SemanticSpelling);
- FormatAttr *mergeFormatAttr(Decl *D, SourceRange Range,
+ FormatAttr *mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI,
IdentifierInfo *Format, int FormatIdx,
- int FirstArg, unsigned AttrSpellingListIndex);
- SectionAttr *mergeSectionAttr(Decl *D, SourceRange Range, StringRef Name,
- unsigned AttrSpellingListIndex);
- CodeSegAttr *mergeCodeSegAttr(Decl *D, SourceRange Range, StringRef Name,
- unsigned AttrSpellingListIndex);
- AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D, SourceRange Range,
- IdentifierInfo *Ident,
- unsigned AttrSpellingListIndex);
- MinSizeAttr *mergeMinSizeAttr(Decl *D, SourceRange Range,
- unsigned AttrSpellingListIndex);
+ int FirstArg);
+ SectionAttr *mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI,
+ StringRef Name);
+ CodeSegAttr *mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI,
+ StringRef Name);
+ AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D,
+ const AttributeCommonInfo &CI,
+ const IdentifierInfo *Ident);
+ MinSizeAttr *mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI);
NoSpeculativeLoadHardeningAttr *
mergeNoSpeculativeLoadHardeningAttr(Decl *D,
const NoSpeculativeLoadHardeningAttr &AL);
SpeculativeLoadHardeningAttr *
mergeSpeculativeLoadHardeningAttr(Decl *D,
const SpeculativeLoadHardeningAttr &AL);
- OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D, SourceRange Range,
- unsigned AttrSpellingListIndex);
+ OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D,
+ const AttributeCommonInfo &CI);
InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL);
InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D,
const InternalLinkageAttr &AL);
@@ -8899,51 +8895,50 @@ public:
void AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD, SourceLocation Loc);
/// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
- void AddAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E,
- unsigned SpellingListIndex, bool IsPackExpansion);
- void AddAlignedAttr(SourceRange AttrRange, Decl *D, TypeSourceInfo *T,
- unsigned SpellingListIndex, bool IsPackExpansion);
+ void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
+ bool IsPackExpansion);
+ void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, TypeSourceInfo *T,
+ bool IsPackExpansion);
/// AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular
/// declaration.
- void AddAssumeAlignedAttr(SourceRange AttrRange, Decl *D, Expr *E, Expr *OE,
- unsigned SpellingListIndex);
+ void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
+ Expr *OE);
/// AddAllocAlignAttr - Adds an alloc_align attribute to a particular
/// declaration.
- void AddAllocAlignAttr(SourceRange AttrRange, Decl *D, Expr *ParamExpr,
- unsigned SpellingListIndex);
+ void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI,
+ Expr *ParamExpr);
/// AddAlignValueAttr - Adds an align_value attribute to a particular
/// declaration.
- void AddAlignValueAttr(SourceRange AttrRange, Decl *D, Expr *E,
- unsigned SpellingListIndex);
+ void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E);
/// AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular
/// declaration.
- void AddLaunchBoundsAttr(SourceRange AttrRange, Decl *D, Expr *MaxThreads,
- Expr *MinBlocks, unsigned SpellingListIndex);
+ void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI,
+ Expr *MaxThreads, Expr *MinBlocks);
/// AddModeAttr - Adds a mode attribute to a particular declaration.
- void AddModeAttr(SourceRange AttrRange, Decl *D, IdentifierInfo *Name,
- unsigned SpellingListIndex, bool InInstantiation = false);
+ void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name,
+ bool InInstantiation = false);
- void AddParameterABIAttr(SourceRange AttrRange, Decl *D,
- ParameterABI ABI, unsigned SpellingListIndex);
+ void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI,
+ ParameterABI ABI);
enum class RetainOwnershipKind {NS, CF, OS};
- void AddXConsumedAttr(Decl *D, SourceRange SR, unsigned SpellingIndex,
+ void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI,
RetainOwnershipKind K, bool IsTemplateInstantiation);
/// addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size
/// attribute to a particular declaration.
- void addAMDGPUFlatWorkGroupSizeAttr(SourceRange AttrRange, Decl *D, Expr *Min,
- Expr *Max, unsigned SpellingListIndex);
+ void addAMDGPUFlatWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI,
+ Expr *Min, Expr *Max);
/// addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a
/// particular declaration.
- void addAMDGPUWavesPerEUAttr(SourceRange AttrRange, Decl *D, Expr *Min,
- Expr *Max, unsigned SpellingListIndex);
+ void addAMDGPUWavesPerEUAttr(Decl *D, const AttributeCommonInfo &CI,
+ Expr *Min, Expr *Max);
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type);