aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hunt <rideau3@gmail.com>2010-06-17 01:51:32 +0000
committerSean Hunt <rideau3@gmail.com>2010-06-17 01:51:32 +0000
commit9c3e84ffe0938cd6a73dd16d9a8b54b498863fef (patch)
tree140c92faa3aa313307faf15b7b940642330fffbd
parent01cb1aa458516b9061a65ea4b8a2ca55f71cb34f (diff)
Comment Attr.td so people have a better understanding of what goes on.
Also removed the unused Aliases member. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106202 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/Attr.td19
1 files changed, 17 insertions, 2 deletions
diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td
index 417faf3a27..2b4e5c3a4a 100644
--- a/include/clang/Basic/Attr.td
+++ b/include/clang/Basic/Attr.td
@@ -4,6 +4,10 @@
// be reached at rideau3@gmail.com.
////////////////////////////////////////////////////////////////////////////////
+// An attribute's subject is whatever it appertains to. In this file, it is
+// more accurately a list of things that an attribute can appertain to. All
+// Decls and Stmts are possibly AttrSubjects (even though the syntax may not
+// allow attributes on a given Decl or Stmt).
class AttrSubject;
include "clang/Basic/DeclNodes.td"
@@ -18,7 +22,6 @@ include "clang/Basic/StmtNodes.td"
// The code fragment is a boolean expression that will confirm that the subject
// meets the requirements; the subject will have the name S, and will have the
// type specified by the base. It should be a simple boolean expression.
-
class SubsetSubject<AttrSubject base, string description, code check>
: AttrSubject {
AttrSubject Base = base;
@@ -26,6 +29,8 @@ class SubsetSubject<AttrSubject base, string description, code check>
code CheckCode = check;
}
+// This is the type of a variable which C++0x defines [[aligned()]] as being
+// a possible subject.
def NormalVar : SubsetSubject<Var, "non-register, non-parameter variable",
[{S->getStorageClass() != VarDecl::Register &&
S->getKind() != Decl::ImplicitParam
@@ -36,6 +41,7 @@ def CXXVirtualMethod : SubsetSubject<CXXRecord, "virtual member function",
def NonBitField : SubsetSubject<Field, "non-bit field",
[{!S->isBitField()}]>;
+// A single argument to an attribute
class Argument<string name> {
string Name = name;
}
@@ -49,20 +55,29 @@ class ObjCInterfaceArgument<string name> : Argument<name>;
class UnsignedIntArgument<string name> : Argument<name>;
class UnsignedIntOrTypeArgument<string name> : Argument<name>;
+// An integer argument with a default value
class DefaultIntArgument<string name, int default> : IntArgument<name> {
int Default = default;
}
+// Zero or more arguments of a type
class VariadicArgument<Argument arg> : Argument<arg.Name> {
Argument VariadicArg = arg;
}
class Attr {
+ // The various ways in which an attribute can be spelled in source
list<string> Spellings;
+ // The things to which an attribute can appertain
list<AttrSubject> Subjects;
+ // The arguments allowed on an attribute
list<Argument> Args = [];
+ // The namespaces in which the attribute appears in C++0x attributes.
+ // The attribute will not be permitted in C++0x attribute-specifiers if
+ // this is empty; the empty string can be used as a namespace.
list<string> Namespaces = [];
- list<string> Aliases = [];
+ // A temporary development bit to tell TableGen not to emit certain
+ // information about the attribute.
bit DoNotEmit = 1;
}