* CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes.
*
* The policy about the libclang API was always to keep it source and ABI
- * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
- */
-#define CINDEX_VERSION_MAJOR 0
-#define CINDEX_VERSION_MINOR 45
-
-#define CINDEX_VERSION_ENCODE(major, minor) ( \
- ((major) * 10000) \
+ * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.\r
+ */\r
+#define CINDEX_VERSION_MAJOR 0\r
+#define CINDEX_VERSION_MINOR 46\r
+\r
+#define CINDEX_VERSION_ENCODE(major, minor) ( \\r
+ ((major) * 10000) \\r
+ ((minor) * 1))
#define CINDEX_VERSION CINDEX_VERSION_ENCODE( \
/**
* \brief Determine whether the given cursor kind represents a declaration.
- */
-CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);
-
-/**
- * \brief Determine whether the given cursor kind represents a simple
- * reference.
+ */\r
+CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);\r
+\r
+/**\r
+ * \brief Determine whether the given declaration is invalid.\r
+ *\r
+ * A declaration is invalid if it could not be parsed successfully.\r
+ *\r
+ * \returns non-zero if the cursor represents a declaration and it is\r
+ * invalid, otherwise NULL.\r
+ */\r
+CINDEX_LINKAGE unsigned clang_isInvalidDeclaration(CXCursor);\r
+\r
+/**\r
+ * \brief Determine whether the given cursor kind represents a simple\r
+ * reference.\r
*
* Note that other kinds of cursors (such as expressions) can also refer to
* other cursors. Use clang_getCursorReferenced() to determine whether a
// from SemaCXX/class-layout.cpp
// RUN: c-index-test -test-print-type-size %s -target x86_64-pc-linux-gnu | FileCheck -check-prefix=CHECK64 %s
// RUN: c-index-test -test-print-type-size %s -target i386-apple-darwin9 | FileCheck -check-prefix=CHECK32 %s
-
-namespace basic {
-
-// CHECK64: VarDecl=v:[[@LINE+2]]:6 (Definition) [type=void] [typekind=Void]
-// CHECK32: VarDecl=v:[[@LINE+1]]:6 (Definition) [type=void] [typekind=Void]
-void v;
-
-// CHECK64: VarDecl=v1:[[@LINE+2]]:7 (Definition) [type=void *] [typekind=Pointer] [sizeof=8] [alignof=8]
+\r
+namespace basic {\r
+\r
+// CHECK64: VarDecl=v:[[@LINE+2]]:6 (Definition) (invalid) [type=void] [typekind=Void]\r
+// CHECK32: VarDecl=v:[[@LINE+1]]:6 (Definition) (invalid) [type=void] [typekind=Void]\r
+void v;\r
+\r
+// CHECK64: VarDecl=v1:[[@LINE+2]]:7 (Definition) [type=void *] [typekind=Pointer] [sizeof=8] [alignof=8]\r
// CHECK32: VarDecl=v1:[[@LINE+1]]:7 (Definition) [type=void *] [typekind=Pointer] [sizeof=4] [alignof=4]
void *v1;
if (clang_EnumDecl_isScoped(Cursor))
printf(" (scoped)");
if (clang_Cursor_isVariadic(Cursor))
- printf(" (variadic)");
- if (clang_Cursor_isObjCOptional(Cursor))
- printf(" (@optional)");
-
- switch (clang_getCursorExceptionSpecificationType(Cursor))
- {
+ printf(" (variadic)");\r
+ if (clang_Cursor_isObjCOptional(Cursor))\r
+ printf(" (@optional)");\r
+ if (clang_isInvalidDeclaration(Cursor))\r
+ printf(" (invalid)");\r
+\r
+ switch (clang_getCursorExceptionSpecificationType(Cursor))\r
+ {\r
case CXCursor_ExceptionSpecificationKind_None:
break;
unsigned clang_isDeclaration(enum CXCursorKind K) {
return (K >= CXCursor_FirstDecl && K <= CXCursor_LastDecl) ||
- (K >= CXCursor_FirstExtraDecl && K <= CXCursor_LastExtraDecl);
-}
-
-unsigned clang_isReference(enum CXCursorKind K) {
- return K >= CXCursor_FirstRef && K <= CXCursor_LastRef;
-}
+ (K >= CXCursor_FirstExtraDecl && K <= CXCursor_LastExtraDecl);\r
+}\r
+\r
+unsigned clang_isInvalidDeclaration(CXCursor C) {\r
+ if (clang_isDeclaration(C.kind)) {\r
+ if (const Decl *D = getCursorDecl(C))\r
+ return D->isInvalidDecl();\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+unsigned clang_isReference(enum CXCursorKind K) {\r
+ return K >= CXCursor_FirstRef && K <= CXCursor_LastRef;\r
+}\r
unsigned clang_isExpression(enum CXCursorKind K) {
return K >= CXCursor_FirstExpr && K <= CXCursor_LastExpr;
clang_index_setClientContainer
clang_index_setClientEntity
clang_isAttribute
-clang_isConstQualifiedType
-clang_isCursorDefinition
-clang_isDeclaration
-clang_isExpression
-clang_isFileMultipleIncludeGuarded
-clang_isFunctionTypeVariadic
+clang_isConstQualifiedType\r
+clang_isCursorDefinition\r
+clang_isDeclaration\r
+clang_isInvalidDeclaration\r
+clang_isExpression\r
+clang_isFileMultipleIncludeGuarded\r
+clang_isFunctionTypeVariadic\r
clang_isInvalid
clang_isPODType
clang_isPreprocessing