diff options
Diffstat (limited to 'lib/Index/IndexDecl.cpp')
-rw-r--r-- | lib/Index/IndexDecl.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index 1225391dc2a6..7d60aad3895d 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -46,10 +46,13 @@ public: } void handleDeclarator(const DeclaratorDecl *D, - const NamedDecl *Parent = nullptr) { + const NamedDecl *Parent = nullptr, + bool isIBType = false) { if (!Parent) Parent = D; - IndexCtx.indexTypeSourceInfo(D->getTypeSourceInfo(), Parent); + IndexCtx.indexTypeSourceInfo(D->getTypeSourceInfo(), Parent, + Parent->getLexicalDeclContext(), + /*isBase=*/false, isIBType); IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), Parent); if (IndexCtx.shouldIndexFunctionLocalSymbols()) { // Only index parameters in definitions, parameters in declarations are @@ -92,8 +95,11 @@ public: if (!IndexCtx.handleDecl(D, (unsigned)SymbolRole::Dynamic, Relations)) return false; IndexCtx.indexTypeSourceInfo(D->getReturnTypeSourceInfo(), D); - for (const auto *I : D->parameters()) - handleDeclarator(I, D); + bool hasIBActionAndFirst = D->hasAttr<IBActionAttr>(); + for (const auto *I : D->parameters()) { + handleDeclarator(I, D, /*isIBType=*/hasIBActionAndFirst); + hasIBActionAndFirst = false; + } if (D->isThisDeclarationADefinition()) { const Stmt *Body = D->getBody(); @@ -283,11 +289,12 @@ public: bool VisitObjCCategoryDecl(const ObjCCategoryDecl *D) { const ObjCInterfaceDecl *C = D->getClassInterface(); - if (C) - TRY_TO(IndexCtx.handleReference(C, D->getLocation(), D, D, - SymbolRoleSet(), SymbolRelation{ - (unsigned)SymbolRole::RelationExtendedBy, D - })); + if (!C) + return true; + TRY_TO(IndexCtx.handleReference(C, D->getLocation(), D, D, SymbolRoleSet(), + SymbolRelation{ + (unsigned)SymbolRole::RelationExtendedBy, D + })); SourceLocation CategoryLoc = D->getCategoryNameLoc(); if (!CategoryLoc.isValid()) CategoryLoc = D->getLocation(); @@ -333,6 +340,9 @@ public: handleObjCMethod(MD, D); if (!IndexCtx.handleDecl(D)) return false; + if (IBOutletCollectionAttr *attr = D->getAttr<IBOutletCollectionAttr>()) + IndexCtx.indexTypeSourceInfo(attr->getInterfaceLoc(), D, + D->getLexicalDeclContext(), false, true); IndexCtx.indexTypeSourceInfo(D->getTypeSourceInfo(), D); return true; } |