summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/test/Misc/ast-dump-attr.cpp10
-rw-r--r--clang/utils/TableGen/ClangAttrEmitter.cpp8
2 files changed, 13 insertions, 5 deletions
diff --git a/clang/test/Misc/ast-dump-attr.cpp b/clang/test/Misc/ast-dump-attr.cpp
index 5b96797d120..1f0e780558f 100644
--- a/clang/test/Misc/ast-dump-attr.cpp
+++ b/clang/test/Misc/ast-dump-attr.cpp
@@ -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
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 7caba492b3b..f06a1cb7464 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -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()
OpenPOWER on IntegriCloud