Skip to content
Snippets Groups Projects
Commit 3ae45cd6 authored by Aaron Ballman's avatar Aaron Ballman
Browse files

If an attribute has a semantically meaningful spelling (such as...

If an attribute has a semantically meaningful spelling (such as ArgumentWithTypeTagAttr or MSInheritanceAttr), display the spelling used for the attribute as part of the AST dump. This should ease debugging the AST for these attributes. Attributes without semantically meaningful spelling variations are not affected.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199834 91177308-0d34-0410-b5e6-96231b3b80d8
parent 01d8f1c5
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment