From 95f33555a6d51b6537a9ed3968c3d1c2e4991b51 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 26 Aug 2010 01:42:22 +0000 Subject: 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 --- tools/libclang/CIndex.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tools/libclang/CIndex.cpp') 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" @@ -3055,6 +3056,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(cxcursor::getCursorAttr(C)); + + return cxtype::MakeCXType(A->getInterface(), cxcursor::getCursorASTUnit(C)); +} +} // end: extern "C" + //===----------------------------------------------------------------------===// // CXString Operations. //===----------------------------------------------------------------------===// -- cgit v1.2.3-18-g5258