]> granicus.if.org Git - clang/commitdiff
Introduce the notion of 'ignored' attributes, so that all attributes
authorDouglas Gregor <dgregor@apple.com>
Wed, 2 May 2012 16:18:45 +0000 (16:18 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 2 May 2012 16:18:45 +0000 (16:18 +0000)
we accept are not modeled somehow via Attr.td.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155998 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Attr.td
lib/Sema/AttributeList.cpp
utils/TableGen/ClangAttrEmitter.cpp

index 8708b6ff30cb78348003c9221875dbaaa9215422..3638deaa4ca757f0632ec7755fa3bacbf1dd9c4e 100644 (file)
@@ -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",
index dd478f2a2b0c7f3f15d305654e5a07ef9ae28c77..cbd2ba4194190f58385472700fdc7ff4f650fef7 100644 (file)
@@ -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);
 }
index d3ba5a9ced954cd0d92467198fe6a1cf508b1b61..112d9a5f23ffd642fa73d75cf035ee352a8e36dd 100644 (file)
@@ -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";
       }
     }
   }