aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/include/clang/AST/Attr.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/AST/Attr.h')
-rw-r--r--contrib/llvm-project/clang/include/clang/AST/Attr.h39
1 files changed, 28 insertions, 11 deletions
diff --git a/contrib/llvm-project/clang/include/clang/AST/Attr.h b/contrib/llvm-project/clang/include/clang/AST/Attr.h
index 1b457337d658..e453733ab92c 100644
--- a/contrib/llvm-project/clang/include/clang/AST/Attr.h
+++ b/contrib/llvm-project/clang/include/clang/AST/Attr.h
@@ -162,6 +162,21 @@ public:
}
};
+class DeclOrStmtAttr : public InheritableAttr {
+protected:
+ DeclOrStmtAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo,
+ attr::Kind AK, bool IsLateParsed,
+ bool InheritEvenIfAlreadyPresent)
+ : InheritableAttr(Context, CommonInfo, AK, IsLateParsed,
+ InheritEvenIfAlreadyPresent) {}
+
+public:
+ static bool classof(const Attr *A) {
+ return A->getKind() >= attr::FirstDeclOrStmtAttr &&
+ A->getKind() <= attr::LastDeclOrStmtAttr;
+ }
+};
+
class InheritableParamAttr : public InheritableAttr {
protected:
InheritableParamAttr(ASTContext &Context,
@@ -259,7 +274,10 @@ public:
/// Construct from a result from \c serialize.
static ParamIdx deserialize(SerialType S) {
- ParamIdx P(*reinterpret_cast<ParamIdx *>(&S));
+ // Using this two-step static_cast via void * instead of reinterpret_cast
+ // silences a -Wstrict-aliasing false positive from GCC7 and earlier.
+ void *ParamIdxPtr = static_cast<void *>(&S);
+ ParamIdx P(*static_cast<ParamIdx *>(ParamIdxPtr));
assert((!P.IsValid || P.Idx >= 1) && "valid Idx must be one-origin");
return P;
}
@@ -334,29 +352,28 @@ static_assert(sizeof(ParamIdx) == sizeof(ParamIdx::SerialType),
struct ParsedTargetAttr {
std::vector<std::string> Features;
StringRef Architecture;
+ StringRef Tune;
StringRef BranchProtection;
bool DuplicateArchitecture = false;
+ bool DuplicateTune = false;
bool operator ==(const ParsedTargetAttr &Other) const {
return DuplicateArchitecture == Other.DuplicateArchitecture &&
- Architecture == Other.Architecture && Features == Other.Features;
+ DuplicateTune == Other.DuplicateTune &&
+ Architecture == Other.Architecture &&
+ Tune == Other.Tune &&
+ BranchProtection == Other.BranchProtection &&
+ Features == Other.Features;
}
};
#include "clang/AST/Attrs.inc"
-inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
- const Attr *At) {
+inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
+ const Attr *At) {
DB.AddTaggedVal(reinterpret_cast<intptr_t>(At),
DiagnosticsEngine::ak_attr);
return DB;
}
-
-inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
- const Attr *At) {
- PD.AddTaggedVal(reinterpret_cast<intptr_t>(At),
- DiagnosticsEngine::ak_attr);
- return PD;
-}
} // end namespace clang
#endif