]> granicus.if.org Git - clang/commitdiff
If an attribute has a semantically meaningful spelling (such as ArgumentWithTypeTagAt...
authorAaron Ballman <aaron@aaronballman.com>
Wed, 22 Jan 2014 21:51:20 +0000 (21:51 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Wed, 22 Jan 2014 21:51:20 +0000 (21:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199834 91177308-0d34-0410-b5e6-96231b3b80d8

test/Misc/ast-dump-attr.cpp
utils/TableGen/ClangAttrEmitter.cpp

index 5b96797d1204d94715a69b0f089c546971264edb..1f0e780558fdb5a5414258a7c3c31de2017d3d0b 100644 (file)
@@ -29,12 +29,12 @@ void TestAttributedStmt() {
 
 int TestAlignedNull __attribute__((aligned));
 // CHECK:      VarDecl{{.*}}TestAlignedNull
-// CHECK-NEXT:   AlignedAttr
+// CHECK-NEXT:   AlignedAttr {{.*}} aligned
 // CHECK-NEXT:     <<<NULL>>>
 
 int TestAlignedExpr __attribute__((aligned(4)));
 // CHECK:      VarDecl{{.*}}TestAlignedExpr
-// CHECK-NEXT:   AlignedAttr
+// CHECK-NEXT:   AlignedAttr {{.*}} aligned
 // CHECK-NEXT:     IntegerLiteral
 
 int TestEnum __attribute__((visibility("default")));
@@ -63,17 +63,17 @@ void function1(void *) {
 void TestIdentifier(void *, int)
 __attribute__((pointer_with_type_tag(ident1,1,2)));
 // CHECK: FunctionDecl{{.*}}TestIdentifier
-// CHECK:   ArgumentWithTypeTagAttr{{.*}} ident1
+// CHECK:   ArgumentWithTypeTagAttr{{.*}} pointer_with_type_tag ident1
 
 void TestBool(void *, int)
 __attribute__((pointer_with_type_tag(bool1,1,2)));
 // CHECK: FunctionDecl{{.*}}TestBool
-// CHECK:   ArgumentWithTypeTagAttr{{.*}} IsPointer
+// CHECK:   ArgumentWithTypeTagAttr{{.*}}pointer_with_type_tag bool1 0 1 IsPointer
 
 void TestUnsigned(void *, int)
 __attribute__((pointer_with_type_tag(unsigned1,1,2)));
 // CHECK: FunctionDecl{{.*}}TestUnsigned
-// CHECK:   ArgumentWithTypeTagAttr{{.*}} 0 1
+// CHECK:   ArgumentWithTypeTagAttr{{.*}} pointer_with_type_tag unsigned1 0 1
 
 void TestInt(void) __attribute__((constructor(123)));
 // CHECK:      FunctionDecl{{.*}}TestInt
index 7caba492b3b8f013591ef2d2b7f18ce5536683e0..f06a1cb7464886fc897bbe7a435961323455db47 100644 (file)
@@ -2482,6 +2482,14 @@ void EmitClangAttrDump(RecordKeeper &Records, raw_ostream &OS) {
     if (!R.getValueAsBit("ASTNode"))
       continue;
     OS << "  case attr::" << R.getName() << ": {\n";
+
+    // If the attribute has a semantically-meaningful name (which is determined
+    // by whether there is a Spelling enumeration for it), then write out the
+    // spelling used for the attribute.
+    std::vector<Record *> Spellings = R.getValueAsListOfDefs("Spellings");
+    if (Spellings.size() > 1 && !SpellingNamesAreCommon(Spellings))
+      OS << "    OS << \" \" << A->getSpelling();\n";
+
     Args = R.getValueAsListOfDefs("Args");
     if (!Args.empty()) {
       OS << "    const " << R.getName() << "Attr *SA = cast<" << R.getName()