Add function 'clang_isTagDeclDefinition()' to allow clients of libclang to distinguish between
forward declarations and definitions of structs/classes/enums.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104075 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 6ea1619..85383d0 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -2809,6 +2809,15 @@
CXXMethodDecl *D = dyn_cast<CXXMethodDecl>(cxcursor::getCursorDecl(C));
return (D && D->isStatic()) ? 1 : 0;
}
+
+unsigned clang_isTagDeclDefinition(CXCursor C) {
+ if (!clang_isDeclaration(C.kind))
+ return 0;
+
+ const TagDecl *D = dyn_cast<TagDecl>(cxcursor::getCursorDecl(C));
+ return D && D->isDefinition() ? 1 : 0;
+}
+
} // end: extern "C"
//===----------------------------------------------------------------------===//