diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-15 06:20:16 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-11-15 06:20:16 +0000 |
commit | d992e1439409165453cb7ec6c8736c5518ee914a (patch) | |
tree | 419239a8a84a954882e9aec4525fc7a7828ece5a /clang/tools/libclang/IndexingContext.cpp | |
parent | 05baa85f58b741f566831f4a29487368d59ad053 (diff) | |
download | bcm5719-llvm-d992e1439409165453cb7ec6c8736c5518ee914a.tar.gz bcm5719-llvm-d992e1439409165453cb7ec6c8736c5518ee914a.zip |
[libclang] Introduce a new function to apply the indexing callbacks on an existing
CXTranslationUnit, mainly to be used for indexing a PCH.
llvm-svn: 144623
Diffstat (limited to 'clang/tools/libclang/IndexingContext.cpp')
-rw-r--r-- | clang/tools/libclang/IndexingContext.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/clang/tools/libclang/IndexingContext.cpp b/clang/tools/libclang/IndexingContext.cpp index 24727fab221..3ab29e2e5bf 100644 --- a/clang/tools/libclang/IndexingContext.cpp +++ b/clang/tools/libclang/IndexingContext.cpp @@ -95,6 +95,13 @@ void IndexingContext::handleDiagnostic(const StoredDiagnostic &StoredDiag) { CB.diagnostic(ClientData, &CXDiag, 0); } +void IndexingContext::handleDiagnostic(CXDiagnostic CXDiag) { + if (!CB.diagnostic) + return; + + CB.diagnostic(ClientData, CXDiag, 0); +} + void IndexingContext::handleDecl(const NamedDecl *D, SourceLocation Loc, CXCursor Cursor, DeclInfo &DInfo) { @@ -230,11 +237,17 @@ void IndexingContext::handleObjCCategory(const ObjCCategoryDecl *D) { ObjCCategoryDeclInfo CatDInfo(/*isImplementation=*/false); CXIdxEntityInfo ClassEntity; StrAdapter SA(*this); + const ObjCInterfaceDecl *IFaceD = D->getClassInterface(); + SourceLocation ClassLoc = D->getLocation(); + SourceLocation CategoryLoc = D->getCategoryNameLoc(); getEntityInfo(D->getClassInterface(), ClassEntity, SA); CatDInfo.ObjCCatDeclInfo.containerInfo = &CatDInfo.ObjCContDeclInfo; CatDInfo.ObjCCatDeclInfo.objcClass = &ClassEntity; - handleObjCContainer(D, D->getLocation(), getCursor(D), CatDInfo); + CatDInfo.ObjCCatDeclInfo.classCursor = + MakeCursorObjCClassRef(IFaceD, ClassLoc, CXTU); + CatDInfo.ObjCCatDeclInfo.classLoc = getIndexLoc(ClassLoc); + handleObjCContainer(D, CategoryLoc, getCursor(D), CatDInfo); } void IndexingContext::handleObjCCategoryImpl(const ObjCCategoryImplDecl *D) { |