aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/c-index-test/c-index-test.c
diff options
context:
space:
mode:
authorIvan Donchevskii <yv.ivan@gmail.com>2019-04-29 13:44:07 +0000
committerIvan Donchevskii <yv.ivan@gmail.com>2019-04-29 13:44:07 +0000
commit50be573ed207baa477e209cf9e8b247ddd402bc5 (patch)
tree779ac3518b92a420bbe4a1c9cb3f015cef7ab6ba /clang/tools/c-index-test/c-index-test.c
parent5a33047022ca4b7863be05b4be75678d5c0a44ee (diff)
downloadllvm-50be573ed207baa477e209cf9e8b247ddd402bc5.zip
llvm-50be573ed207baa477e209cf9e8b247ddd402bc5.tar.gz
llvm-50be573ed207baa477e209cf9e8b247ddd402bc5.tar.bz2
[libclang] Restore old clang_Cursor_isAnonymous behaviour
D54996 Changed the behaviour of clang_Cursor_isAnonymous, but there is no alternative available to get the old behaviour in some cases, which is essential for determining if a record is syntactically accessible, e.g. struct { int x; int y; } foo; struct { struct { int x; int y; }; } bar; void fun(struct { int x; int y; } *param); The only 'anonymous' struct here is the one nested in bar, since there is no way to reference the struct itself, only the fields within. Though the anonymity applies to the instance itself, not the type. To avoid confusion, I have added a new function called clang_Cursor_isAnonymousRecordDecl which has the old behaviour of clang_Cursor_isAnonymous (and updated the doc for the latter as well, which was seemingly forgotten). Patch by Jorn Vernee. Differential Revision: https://reviews.llvm.org/D61232 llvm-svn: 359448
Diffstat (limited to 'clang/tools/c-index-test/c-index-test.c')
-rw-r--r--clang/tools/c-index-test/c-index-test.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/tools/c-index-test/c-index-test.c b/clang/tools/c-index-test/c-index-test.c
index 2cf442e..17b773c 100644
--- a/clang/tools/c-index-test/c-index-test.c
+++ b/clang/tools/c-index-test/c-index-test.c
@@ -1665,6 +1665,12 @@ static enum CXChildVisitResult PrintType(CXCursor cursor, CXCursor p,
}
}
+ /* Print if it is an anonymous record decl */
+ {
+ unsigned isAnonRecDecl = clang_Cursor_isAnonymousRecordDecl(cursor);
+ printf(" [isAnonRecDecl=%d]", isAnonRecDecl);
+ }
+
printf("\n");
}
return CXChildVisit_Recurse;