Implement first TD-based usage of attributes.

Currently, there are two effective changes:

 - Attr::Kind has been changed to attr::Kind, in a separate namespace
   rather than the Attr class. This is because the enumerator needs to
   be visible to parse.
 - The class definitions for the C++0x attributes other than aligned are
   generated by TableGen.

The specific classes generated by TableGen are controlled by an array in
TableGen (see the accompanying commit to the LLVM repository). I will be
expanding the amount of code generated as I develop the new attributes system
while initially keeping it confined to these attributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106172 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp
index cece1b6..78ae5f0 100644
--- a/lib/Frontend/PCHReaderDecl.cpp
+++ b/lib/Frontend/PCHReaderDecl.cpp
@@ -679,24 +679,24 @@
   (void)RecCode;
 
 #define SIMPLE_ATTR(Name)                       \
- case Attr::Name:                               \
+ case attr::Name:                               \
    New = ::new (*Context) Name##Attr();         \
    break
 
 #define STRING_ATTR(Name)                                       \
- case Attr::Name:                                               \
+ case attr::Name:                                               \
    New = ::new (*Context) Name##Attr(*Context, ReadString(Record, Idx));  \
    break
 
 #define UNSIGNED_ATTR(Name)                             \
- case Attr::Name:                                       \
+ case attr::Name:                                       \
    New = ::new (*Context) Name##Attr(Record[Idx++]);    \
    break
 
   Attr *Attrs = 0;
   while (Idx < Record.size()) {
     Attr *New = 0;
-    Attr::Kind Kind = (Attr::Kind)Record[Idx++];
+    attr::Kind Kind = (attr::Kind)Record[Idx++];
     bool IsInherited = Record[Idx++];
 
     switch (Kind) {
@@ -712,14 +712,14 @@
     STRING_ATTR(AsmLabel);
     SIMPLE_ATTR(BaseCheck);
 
-    case Attr::Blocks:
+    case attr::Blocks:
       New = ::new (*Context) BlocksAttr(
                                   (BlocksAttr::BlocksAttrTypes)Record[Idx++]);
       break;
 
     SIMPLE_ATTR(CDecl);
 
-    case Attr::Cleanup:
+    case attr::Cleanup:
       New = ::new (*Context) CleanupAttr(
                                   cast<FunctionDecl>(GetDecl(Record[Idx++])));
       break;
@@ -733,7 +733,7 @@
     SIMPLE_ATTR(FastCall);
     SIMPLE_ATTR(Final);
 
-    case Attr::Format: {
+    case attr::Format: {
       std::string Type = ReadString(Record, Idx);
       unsigned FormatIdx = Record[Idx++];
       unsigned FirstArg = Record[Idx++];
@@ -741,13 +741,13 @@
       break;
     }
 
-    case Attr::FormatArg: {
+    case attr::FormatArg: {
       unsigned FormatIdx = Record[Idx++];
       New = ::new (*Context) FormatArgAttr(FormatIdx);
       break;
     }
 
-    case Attr::Sentinel: {
+    case attr::Sentinel: {
       int sentinel = Record[Idx++];
       int nullPos = Record[Idx++];
       New = ::new (*Context) SentinelAttr(sentinel, nullPos);
@@ -757,15 +757,15 @@
     SIMPLE_ATTR(GNUInline);
     SIMPLE_ATTR(Hiding);
 
-    case Attr::IBActionKind:
+    case attr::IBAction:
       New = ::new (*Context) IBActionAttr();
       break;
 
-    case Attr::IBOutletKind:
+    case attr::IBOutlet:
       New = ::new (*Context) IBOutletAttr();
       break;
 
-    case Attr::IBOutletCollectionKind: {
+    case attr::IBOutletCollection: {
       ObjCInterfaceDecl *D =
         cast_or_null<ObjCInterfaceDecl>(GetDecl(Record[Idx++]));
       New = ::new (*Context) IBOutletCollectionAttr(D);
@@ -778,7 +778,7 @@
     SIMPLE_ATTR(NoReturn);
     SIMPLE_ATTR(NoThrow);
 
-    case Attr::NonNull: {
+    case attr::NonNull: {
       unsigned Size = Record[Idx++];
       llvm::SmallVector<unsigned, 16> ArgNums;
       ArgNums.insert(ArgNums.end(), &Record[Idx], &Record[Idx] + Size);
@@ -787,7 +787,7 @@
       break;
     }
 
-    case Attr::ReqdWorkGroupSize: {
+    case attr::ReqdWorkGroupSize: {
       unsigned X = Record[Idx++];
       unsigned Y = Record[Idx++];
       unsigned Z = Record[Idx++];
@@ -815,7 +815,7 @@
     SIMPLE_ATTR(Unused);
     SIMPLE_ATTR(Used);
 
-    case Attr::Visibility:
+    case attr::Visibility:
       New = ::new (*Context) VisibilityAttr(
                               (VisibilityAttr::VisibilityTypes)Record[Idx++]);
       break;
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index a2f7482..b03a7bd 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -1842,66 +1842,66 @@
     default:
       assert(0 && "Does not support PCH writing for this attribute yet!");
       break;
-    case Attr::Alias:
+    case attr::Alias:
       AddString(cast<AliasAttr>(Attr)->getAliasee(), Record);
       break;
 
-    case Attr::AlignMac68k:
+    case attr::AlignMac68k:
       break;
 
-    case Attr::Aligned:
+    case attr::Aligned:
       Record.push_back(cast<AlignedAttr>(Attr)->getAlignment());
       break;
 
-    case Attr::AlwaysInline:
+    case attr::AlwaysInline:
       break;
 
-    case Attr::AnalyzerNoReturn:
+    case attr::AnalyzerNoReturn:
       break;
 
-    case Attr::Annotate:
+    case attr::Annotate:
       AddString(cast<AnnotateAttr>(Attr)->getAnnotation(), Record);
       break;
 
-    case Attr::AsmLabel:
+    case attr::AsmLabel:
       AddString(cast<AsmLabelAttr>(Attr)->getLabel(), Record);
       break;
 
-    case Attr::BaseCheck:
+    case attr::BaseCheck:
       break;
 
-    case Attr::Blocks:
+    case attr::Blocks:
       Record.push_back(cast<BlocksAttr>(Attr)->getType()); // FIXME: stable
       break;
 
-    case Attr::CDecl:
+    case attr::CDecl:
       break;
 
-    case Attr::Cleanup:
+    case attr::Cleanup:
       AddDeclRef(cast<CleanupAttr>(Attr)->getFunctionDecl(), Record);
       break;
 
-    case Attr::Const:
+    case attr::Const:
       break;
 
-    case Attr::Constructor:
+    case attr::Constructor:
       Record.push_back(cast<ConstructorAttr>(Attr)->getPriority());
       break;
 
-    case Attr::DLLExport:
-    case Attr::DLLImport:
-    case Attr::Deprecated:
+    case attr::DLLExport:
+    case attr::DLLImport:
+    case attr::Deprecated:
       break;
 
-    case Attr::Destructor:
+    case attr::Destructor:
       Record.push_back(cast<DestructorAttr>(Attr)->getPriority());
       break;
 
-    case Attr::FastCall:
-    case Attr::Final:
+    case attr::FastCall:
+    case attr::Final:
       break;
 
-    case Attr::Format: {
+    case attr::Format: {
       const FormatAttr *Format = cast<FormatAttr>(Attr);
       AddString(Format->getType(), Record);
       Record.push_back(Format->getFormatIdx());
@@ -1909,93 +1909,93 @@
       break;
     }
 
-    case Attr::FormatArg: {
+    case attr::FormatArg: {
       const FormatArgAttr *Format = cast<FormatArgAttr>(Attr);
       Record.push_back(Format->getFormatIdx());
       break;
     }
 
-    case Attr::Sentinel : {
+    case attr::Sentinel : {
       const SentinelAttr *Sentinel = cast<SentinelAttr>(Attr);
       Record.push_back(Sentinel->getSentinel());
       Record.push_back(Sentinel->getNullPos());
       break;
     }
 
-    case Attr::GNUInline:
-    case Attr::Hiding:
-    case Attr::IBActionKind:
-    case Attr::IBOutletKind:
-    case Attr::Malloc:
-    case Attr::NoDebug:
-    case Attr::NoInline:
-    case Attr::NoReturn:
-    case Attr::NoThrow:
+    case attr::GNUInline:
+    case attr::Hiding:
+    case attr::IBAction:
+    case attr::IBOutlet:
+    case attr::Malloc:
+    case attr::NoDebug:
+    case attr::NoInline:
+    case attr::NoReturn:
+    case attr::NoThrow:
       break;
 
-    case Attr::IBOutletCollectionKind: {
+    case attr::IBOutletCollection: {
       const IBOutletCollectionAttr *ICA = cast<IBOutletCollectionAttr>(Attr);
       AddDeclRef(ICA->getClass(), Record);
       break;
     }
 
-    case Attr::NonNull: {
+    case attr::NonNull: {
       const NonNullAttr *NonNull = cast<NonNullAttr>(Attr);
       Record.push_back(NonNull->size());
       Record.insert(Record.end(), NonNull->begin(), NonNull->end());
       break;
     }
 
-    case Attr::CFReturnsNotRetained:
-    case Attr::CFReturnsRetained:
-    case Attr::NSReturnsNotRetained:
-    case Attr::NSReturnsRetained:
-    case Attr::ObjCException:
-    case Attr::ObjCNSObject:
-    case Attr::Overloadable:
-    case Attr::Override:
+    case attr::CFReturnsNotRetained:
+    case attr::CFReturnsRetained:
+    case attr::NSReturnsNotRetained:
+    case attr::NSReturnsRetained:
+    case attr::ObjCException:
+    case attr::ObjCNSObject:
+    case attr::Overloadable:
+    case attr::Override:
       break;
 
-    case Attr::MaxFieldAlignment:
+    case attr::MaxFieldAlignment:
       Record.push_back(cast<MaxFieldAlignmentAttr>(Attr)->getAlignment());
       break;
 
-    case Attr::Packed:
+    case attr::Packed:
       break;
 
-    case Attr::Pure:
+    case attr::Pure:
       break;
 
-    case Attr::Regparm:
+    case attr::Regparm:
       Record.push_back(cast<RegparmAttr>(Attr)->getNumParams());
       break;
 
-    case Attr::ReqdWorkGroupSize:
+    case attr::ReqdWorkGroupSize:
       Record.push_back(cast<ReqdWorkGroupSizeAttr>(Attr)->getXDim());
       Record.push_back(cast<ReqdWorkGroupSizeAttr>(Attr)->getYDim());
       Record.push_back(cast<ReqdWorkGroupSizeAttr>(Attr)->getZDim());
       break;
 
-    case Attr::Section:
+    case attr::Section:
       AddString(cast<SectionAttr>(Attr)->getName(), Record);
       break;
 
-    case Attr::StdCall:
-    case Attr::TransparentUnion:
-    case Attr::Unavailable:
-    case Attr::Unused:
-    case Attr::Used:
+    case attr::StdCall:
+    case attr::TransparentUnion:
+    case attr::Unavailable:
+    case attr::Unused:
+    case attr::Used:
       break;
 
-    case Attr::Visibility:
+    case attr::Visibility:
       // FIXME: stable encoding
       Record.push_back(cast<VisibilityAttr>(Attr)->getVisibility());
       break;
 
-    case Attr::WarnUnusedResult:
-    case Attr::Weak:
-    case Attr::WeakRef:
-    case Attr::WeakImport:
+    case attr::WarnUnusedResult:
+    case attr::Weak:
+    case attr::WeakRef:
+    case attr::WeakImport:
       break;
     }
   }