diff options
-rw-r--r-- | include/clang/Basic/Attr.td | 16 | ||||
-rw-r--r-- | lib/Sema/AttributeList.cpp | 2 | ||||
-rw-r--r-- | utils/TableGen/ClangAttrEmitter.cpp | 14 |
3 files changed, 25 insertions, 7 deletions
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 8708b6ff30..3638deaa4c 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -99,6 +99,8 @@ class Attr { bit ASTNode = 1; // Set to true for attributes which have handler in Sema. bit SemaHandler = 1; + // Set to true for attributes that are completely ignored. + bit Ignored = 0; // Any additional text that should be included verbatim in the class. code AdditionalMembers = [{}]; } @@ -180,6 +182,13 @@ def Blocks : InheritableAttr { let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>]; } +def Bounded : Attr { + let Spellings = ["bounded"]; + let ASTNode = 0; + let SemaHandler = 0; + let Ignored = 1; +} + def CarriesDependency : InheritableParamAttr { let Spellings = ["carries_dependency"]; let Subjects = [ParmVar, Function]; @@ -627,6 +636,13 @@ def VectorSize : Attr { let ASTNode = 0; } +def VecTypeHint : Attr { + let Spellings = ["vec_type_hint"]; + let ASTNode = 0; + let SemaHandler = 0; + let Ignored = 1; +} + def Visibility : InheritableAttr { let Spellings = ["visibility"]; let Args = [EnumArgument<"Visibility", "VisibilityType", diff --git a/lib/Sema/AttributeList.cpp b/lib/Sema/AttributeList.cpp index dd478f2a2b..cbd2ba4194 100644 --- a/lib/Sema/AttributeList.cpp +++ b/lib/Sema/AttributeList.cpp @@ -107,7 +107,5 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) { return llvm::StringSwitch<AttributeList::Kind>(AttrName) #include "clang/Sema/AttrParsedAttrKinds.inc" - .Case("bounded", IgnoredAttribute) // OpenBSD - .Case("vec_type_hint", IgnoredAttribute) .Default(UnknownAttribute); } diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp index d3ba5a9ced..112d9a5f23 100644 --- a/utils/TableGen/ClangAttrEmitter.cpp +++ b/utils/TableGen/ClangAttrEmitter.cpp @@ -1093,19 +1093,23 @@ void ClangAttrParsedAttrKindsEmitter::run(raw_ostream &OS) { Record &Attr = **I; bool SemaHandler = Attr.getValueAsBit("SemaHandler"); + bool Ignored = Attr.getValueAsBit("Ignored"); - if (SemaHandler) { + if (SemaHandler || Ignored) { std::vector<StringRef> Spellings = getValueAsListOfStrings(Attr, "Spellings"); for (std::vector<StringRef>::const_iterator I = Spellings.begin(), E = Spellings.end(); I != E; ++I) { - StringRef AttrName = *I, Spelling = *I; + StringRef AttrName = *I, Spelling = *I; - AttrName = NormalizeAttrName(AttrName); - Spelling = NormalizeAttrSpelling(Spelling); + AttrName = NormalizeAttrName(AttrName); + Spelling = NormalizeAttrSpelling(Spelling); - OS << ".Case(\"" << Spelling << "\", " << "AT_" << AttrName << ")\n"; + if (SemaHandler) + OS << ".Case(\"" << Spelling << "\", " << "AT_" << AttrName << ")\n"; + else + OS << ".Case(\"" << Spelling << "\", IgnoredAttribute)\n"; } } } |