aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-04-18 23:53:05 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-04-18 23:53:05 +0000
commit80e1acaeb7040548cb494e609b120b134e22a193 (patch)
tree3383dea0c78a088c9032876fd7a43f6495de6b65 /tools
parent0c7102f070c10a261ea40700cfbb9102f642ad72 (diff)
[libclang] Introduce clang_Cursor_isVariadic, which returns non-zero if the given cursor is a variadic function or method.
rdar://13667150 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179819 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/c-index-test/c-index-test.c3
-rw-r--r--tools/libclang/CIndex.cpp13
-rw-r--r--tools/libclang/libclang.exports1
3 files changed, 17 insertions, 0 deletions
diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index b8664ed75a..9b083e49f5 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -694,6 +694,9 @@ static void PrintCursor(CXCursor Cursor,
printf(" (static)");
if (clang_CXXMethod_isVirtual(Cursor))
printf(" (virtual)");
+
+ if (clang_Cursor_isVariadic(Cursor))
+ printf(" (variadic)");
if (Cursor.kind == CXCursor_IBOutletCollectionAttr) {
CXType T =
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 8a56f4da06..d29e3d8608 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -5972,6 +5972,19 @@ unsigned clang_Cursor_getObjCDeclQualifiers(CXCursor C) {
return Result;
}
+unsigned clang_Cursor_isVariadic(CXCursor C) {
+ if (!clang_isDeclaration(C.kind))
+ return 0;
+
+ const Decl *D = getCursorDecl(C);
+ if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
+ return FD->isVariadic();
+ if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D))
+ return MD->isVariadic();
+
+ return 0;
+}
+
CXSourceRange clang_Cursor_getCommentRange(CXCursor C) {
if (!clang_isDeclaration(C.kind))
return clang_getNullRange();
diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports
index ffea921cad..c7508bc544 100644
--- a/tools/libclang/libclang.exports
+++ b/tools/libclang/libclang.exports
@@ -19,6 +19,7 @@ clang_Cursor_getReceiverType
clang_Cursor_isBitField
clang_Cursor_isDynamicCall
clang_Cursor_isNull
+clang_Cursor_isVariadic
clang_Cursor_getModule
clang_Module_getParent
clang_Module_getName