aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-08-26 01:42:22 +0000
committerTed Kremenek <kremenek@apple.com>2010-08-26 01:42:22 +0000
commit95f33555a6d51b6537a9ed3968c3d1c2e4991b51 (patch)
tree3c81eccf2bf7be2c9a886f9915235871d8727d14 /tools/libclang/CIndex.cpp
parent2dc70ad391cb75ea90a2fb5d14a7f1d271534da3 (diff)
Add libclang API hook "clang_getIBOutletCollectionType" to query the collection type for iboutletcollection attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112139 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndex.cpp')
-rw-r--r--tools/libclang/CIndex.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index c696a27c59..4ec2bf4c29 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -14,6 +14,7 @@
#include "CIndexer.h"
#include "CXCursor.h"
+#include "CXType.h"
#include "CXSourceLocation.h"
#include "CIndexDiagnostic.h"
@@ -3056,6 +3057,22 @@ unsigned clang_CXXMethod_isStatic(CXCursor C) {
} // end: extern "C"
//===----------------------------------------------------------------------===//
+// Attribute introspection.
+//===----------------------------------------------------------------------===//
+
+extern "C" {
+CXType clang_getIBOutletCollectionType(CXCursor C) {
+ if (C.kind != CXCursor_IBOutletCollectionAttr)
+ return cxtype::MakeCXType(QualType(), cxcursor::getCursorASTUnit(C));
+
+ IBOutletCollectionAttr *A =
+ cast<IBOutletCollectionAttr>(cxcursor::getCursorAttr(C));
+
+ return cxtype::MakeCXType(A->getInterface(), cxcursor::getCursorASTUnit(C));
+}
+} // end: extern "C"
+
+//===----------------------------------------------------------------------===//
// CXString Operations.
//===----------------------------------------------------------------------===//