summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/Indexing.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-14 22:39:19 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-11-14 22:39:19 +0000
commit86acd72bd2f344c5dfc4123968d08cc67e1308d5 (patch)
tree0eb9ba57a3056ab7b77c9719b5896069005a9887 /clang/tools/libclang/Indexing.cpp
parent45110fdf8dd0bcc187b7d310b3c643ddd2af0515 (diff)
downloadbcm5719-llvm-86acd72bd2f344c5dfc4123968d08cc67e1308d5.tar.gz
bcm5719-llvm-86acd72bd2f344c5dfc4123968d08cc67e1308d5.zip
[libclang] Slight changes to the indexing API and bigger internal changes for it.
llvm-svn: 144577
Diffstat (limited to 'clang/tools/libclang/Indexing.cpp')
-rw-r--r--clang/tools/libclang/Indexing.cpp50
1 files changed, 30 insertions, 20 deletions
diff --git a/clang/tools/libclang/Indexing.cpp b/clang/tools/libclang/Indexing.cpp
index 8d905059711..3332c654b33 100644
--- a/clang/tools/libclang/Indexing.cpp
+++ b/clang/tools/libclang/Indexing.cpp
@@ -381,46 +381,56 @@ clang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *DInfo) {
if (!DInfo)
return 0;
- if (clang_index_isEntityObjCContainerKind(DInfo->entityInfo->kind))
- return &static_cast<const ObjCContainerDeclInfo*>(DInfo)->ObjCContDeclInfo;
+ const DeclInfo *DI = static_cast<const DeclInfo *>(DInfo);
+ if (const ObjCContainerDeclInfo *
+ ContInfo = dyn_cast<ObjCContainerDeclInfo>(DI))
+ return &ContInfo->ObjCContDeclInfo;
return 0;
}
const CXIdxObjCInterfaceDeclInfo *
clang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *DInfo) {
- if (!DInfo || DInfo->entityInfo->kind != CXIdxEntity_ObjCClass)
+ if (!DInfo)
return 0;
- if (const CXIdxObjCContainerDeclInfo *
- ContInfo = clang_index_getObjCContainerDeclInfo(DInfo)) {
- if (ContInfo->kind == CXIdxObjCContainer_Interface)
- return &static_cast<const ObjCInterfaceDeclInfo*>(DInfo)->ObjCInterDeclInfo;
- }
+ const DeclInfo *DI = static_cast<const DeclInfo *>(DInfo);
+ if (const ObjCInterfaceDeclInfo *
+ InterInfo = dyn_cast<ObjCInterfaceDeclInfo>(DI))
+ return &InterInfo->ObjCInterDeclInfo;
return 0;
}
-const CXIdxObjCProtocolDeclInfo *
-clang_index_getObjCProtocolDeclInfo(const CXIdxDeclInfo *DInfo) {
- if (!DInfo || DInfo->entityInfo->kind != CXIdxEntity_ObjCProtocol)
+const CXIdxObjCCategoryDeclInfo *
+clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *DInfo){
+ if (!DInfo)
return 0;
- if (const CXIdxObjCContainerDeclInfo *
- ContInfo = clang_index_getObjCContainerDeclInfo(DInfo)) {
- if (ContInfo->kind == CXIdxObjCContainer_Interface)
- return &static_cast<const ObjCProtocolDeclInfo*>(DInfo)->ObjCProtoDeclInfo;
- }
+ const DeclInfo *DI = static_cast<const DeclInfo *>(DInfo);
+ if (const ObjCCategoryDeclInfo *
+ CatInfo = dyn_cast<ObjCCategoryDeclInfo>(DI))
+ return &CatInfo->ObjCCatDeclInfo;
return 0;
}
-const CXIdxObjCCategoryDeclInfo *
-clang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *DInfo){
- if (!DInfo || DInfo->entityInfo->kind != CXIdxEntity_ObjCCategory)
+const CXIdxObjCProtocolRefListInfo *
+clang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *DInfo) {
+ if (!DInfo)
return 0;
- return &static_cast<const ObjCCategoryDeclInfo*>(DInfo)->ObjCCatDeclInfo;
+ const DeclInfo *DI = static_cast<const DeclInfo *>(DInfo);
+
+ if (const ObjCInterfaceDeclInfo *
+ InterInfo = dyn_cast<ObjCInterfaceDeclInfo>(DI))
+ return InterInfo->ObjCInterDeclInfo.protocols;
+
+ if (const ObjCProtocolDeclInfo *
+ ProtInfo = dyn_cast<ObjCProtocolDeclInfo>(DI))
+ return &ProtInfo->ObjCProtoRefListInfo;
+
+ return 0;
}
int clang_indexTranslationUnit(CXIndex CIdx,
OpenPOWER on IntegriCloud