Add clang_isPODType() for querying if the CXType is POD. Implements <rdar://problem/8250669>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109822 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index b8d4cb8..795c19c 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -487,6 +487,8 @@
clang_disposeString(RS);
}
}
+ /* Print if this is a non-POD type. */
+ printf(" [isPOD=%d]", clang_isPODType(T));
printf("\n");
}
diff --git a/tools/libclang/CXTypes.cpp b/tools/libclang/CXTypes.cpp
index d5c9f45..b49ef19 100644
--- a/tools/libclang/CXTypes.cpp
+++ b/tools/libclang/CXTypes.cpp
@@ -283,4 +283,11 @@
return MakeCXType(QualType(), cxcursor::getCursorASTUnit(C));
}
+unsigned clang_isPODType(CXType X) {
+ QualType T = GetQualType(X);
+ if (!T.getTypePtr())
+ return 0;
+ return T->isPODType() ? 1 : 0;
+}
+
} // end: extern "C"
diff --git a/tools/libclang/libclang.darwin.exports b/tools/libclang/libclang.darwin.exports
index e51620c..50ed994 100644
--- a/tools/libclang/libclang.darwin.exports
+++ b/tools/libclang/libclang.darwin.exports
@@ -82,6 +82,7 @@
_clang_isExpression
_clang_isInvalid
_clang_isPreprocessing
+_clang_isPODType
_clang_isReference
_clang_isStatement
_clang_isTranslationUnit
diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports
index 3d3e713..752c650 100644
--- a/tools/libclang/libclang.exports
+++ b/tools/libclang/libclang.exports
@@ -82,6 +82,7 @@
clang_isExpression
clang_isInvalid
clang_isPreprocessing
+clang_isPODType
clang_isReference
clang_isStatement
clang_isTranslationUnit