[cfe-commits] r155998 - in /cfe/trunk: include/clang/Basic/Attr.td lib/Sema/AttributeList.cpp utils/TableGen/ClangAttrEmitter.cpp
Douglas Gregor
dgregor at apple.com
Wed May 2 09:18:45 PDT 2012
Author: dgregor
Date: Wed May 2 11:18:45 2012
New Revision: 155998
URL: http://llvm.org/viewvc/llvm-project?rev=155998&view=rev
Log:
Introduce the notion of 'ignored' attributes, so that all attributes
we accept are not modeled somehow via Attr.td.
Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/lib/Sema/AttributeList.cpp
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=155998&r1=155997&r2=155998&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Wed May 2 11:18:45 2012
@@ -99,6 +99,8 @@
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 @@
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 @@
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",
Modified: cfe/trunk/lib/Sema/AttributeList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AttributeList.cpp?rev=155998&r1=155997&r2=155998&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AttributeList.cpp (original)
+++ cfe/trunk/lib/Sema/AttributeList.cpp Wed May 2 11:18:45 2012
@@ -107,7 +107,5 @@
return llvm::StringSwitch<AttributeList::Kind>(AttrName)
#include "clang/Sema/AttrParsedAttrKinds.inc"
- .Case("bounded", IgnoredAttribute) // OpenBSD
- .Case("vec_type_hint", IgnoredAttribute)
.Default(UnknownAttribute);
}
Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=155998&r1=155997&r2=155998&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Wed May 2 11:18:45 2012
@@ -1093,19 +1093,23 @@
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";
}
}
}
More information about the cfe-commits
mailing list