From 952eddef9aff85b1e92626e89baaf7a360e2ac85 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 22 Dec 2013 00:07:40 +0000 Subject: Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3): https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841 --- tools/libclang/IndexingContext.cpp | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'tools/libclang/IndexingContext.cpp') diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp index 14b430c..41ed6ea 100644 --- a/tools/libclang/IndexingContext.cpp +++ b/tools/libclang/IndexingContext.cpp @@ -10,6 +10,7 @@ #include "IndexingContext.h" #include "CIndexDiagnostic.h" #include "CXTranslationUnit.h" +#include "clang/AST/Attr.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclTemplate.h" #include "clang/Frontend/ASTUnit.h" @@ -93,17 +94,19 @@ AttrListInfo::AttrListInfo(const Decl *D, IndexingContext &IdxCtx) const IBOutletCollectionAttr * IBAttr = cast(IBInfo.A); + SourceLocation InterfaceLocStart = + IBAttr->getInterfaceLoc()->getTypeLoc().getLocStart(); IBInfo.IBCollInfo.attrInfo = &IBInfo; - IBInfo.IBCollInfo.classLoc = IdxCtx.getIndexLoc(IBAttr->getInterfaceLoc()); + IBInfo.IBCollInfo.classLoc = IdxCtx.getIndexLoc(InterfaceLocStart); IBInfo.IBCollInfo.objcClass = 0; IBInfo.IBCollInfo.classCursor = clang_getNullCursor(); QualType Ty = IBAttr->getInterface(); - if (const ObjCInterfaceType *InterTy = Ty->getAs()) { - if (const ObjCInterfaceDecl *InterD = InterTy->getInterface()) { + if (const ObjCObjectType *ObjectTy = Ty->getAs()) { + if (const ObjCInterfaceDecl *InterD = ObjectTy->getInterface()) { IdxCtx.getEntityInfo(InterD, IBInfo.ClassInfo, SA); IBInfo.IBCollInfo.objcClass = &IBInfo.ClassInfo; - IBInfo.IBCollInfo.classCursor = MakeCursorObjCClassRef(InterD, - IBAttr->getInterfaceLoc(), IdxCtx.CXTU); + IBInfo.IBCollInfo.classCursor = + MakeCursorObjCClassRef(InterD, InterfaceLocStart, IdxCtx.CXTU); } } } @@ -210,11 +213,13 @@ bool IndexingContext::isFunctionLocalDecl(const Decl *D) { return false; if (const NamedDecl *ND = dyn_cast(D)) { - switch (ND->getLinkage()) { + switch (ND->getFormalLinkage()) { case NoLinkage: + case VisibleNoLinkage: case InternalLinkage: return true; case UniqueExternalLinkage: + llvm_unreachable("Not a sema linkage"); case ExternalLinkage: return false; } @@ -378,14 +383,14 @@ bool IndexingContext::handleFunction(const FunctionDecl *D) { isContainer = false; } - DeclInfo DInfo(!D->isFirstDeclaration(), isDef, isContainer); + DeclInfo DInfo(!D->isFirstDecl(), isDef, isContainer); if (isSkipped) DInfo.flags |= CXIdxDeclFlag_Skipped; return handleDecl(D, D->getLocation(), getCursor(D), DInfo); } bool IndexingContext::handleVar(const VarDecl *D) { - DeclInfo DInfo(!D->isFirstDeclaration(), D->isThisDeclarationADefinition(), + DeclInfo DInfo(!D->isFirstDecl(), D->isThisDeclarationADefinition(), /*isContainer=*/false); return handleDecl(D, D->getLocation(), getCursor(D), DInfo); } @@ -412,13 +417,13 @@ bool IndexingContext::handleTagDecl(const TagDecl *D) { if (const CXXRecordDecl *CXXRD = dyn_cast(D)) return handleCXXRecordDecl(CXXRD, D); - DeclInfo DInfo(!D->isFirstDeclaration(), D->isThisDeclarationADefinition(), + DeclInfo DInfo(!D->isFirstDecl(), D->isThisDeclarationADefinition(), D->isThisDeclarationADefinition()); return handleDecl(D, D->getLocation(), getCursor(D), DInfo); } bool IndexingContext::handleTypedefName(const TypedefNameDecl *D) { - DeclInfo DInfo(!D->isFirstDeclaration(), /*isDefinition=*/true, + DeclInfo DInfo(!D->isFirstDecl(), /*isDefinition=*/true, /*isContainer=*/false); return handleDecl(D, D->getLocation(), getCursor(D), DInfo); } -- cgit v1.1