Index: include/clang-c/Index.h =================================================================== --- include/clang-c/Index.h +++ include/clang-c/Index.h @@ -3920,11 +3920,17 @@ */ CINDEX_LINKAGE long long clang_Cursor_getOffsetOfField(CXCursor C); +/** + * Determine whether the given cursor represents an anonymous + * tag or namespace + */ +CINDEX_LINKAGE unsigned clang_Cursor_isAnonymous(CXCursor C); + /** * Determine whether the given cursor represents an anonymous record * declaration. */ -CINDEX_LINKAGE unsigned clang_Cursor_isAnonymous(CXCursor C); +CINDEX_LINKAGE unsigned clang_Cursor_isAnonymousRecordDecl(CXCursor C); enum CXRefQualifierKind { /** No ref-qualifier was provided. */ Index: tools/libclang/CXType.cpp =================================================================== --- tools/libclang/CXType.cpp +++ tools/libclang/CXType.cpp @@ -1253,6 +1253,16 @@ return 0; } + +unsigned clang_Cursor_isAnonymousRecordDecl(CXCursor C){ + if (!clang_isDeclaration(C.kind)) + return 0; + const Decl *D = cxcursor::getCursorDecl(C); + if (const RecordDecl *FD = dyn_cast_or_null(D)) + return FD->isAnonymousStructOrUnion(); + return 0; +} + CXType clang_Type_getNamedType(CXType CT){ QualType T = GetQualType(CT); const Type *TP = T.getTypePtrOrNull();