diff options
Diffstat (limited to 'lib/Index/IndexDecl.cpp')
-rw-r--r-- | lib/Index/IndexDecl.cpp | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index c5230c0f9acf..e14750e046eb 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -233,9 +233,8 @@ public: if (auto *CXXMD = dyn_cast<CXXMethodDecl>(D)) { if (CXXMD->isVirtual()) Roles |= (unsigned)SymbolRole::Dynamic; - for (auto I = CXXMD->begin_overridden_methods(), - E = CXXMD->end_overridden_methods(); I != E; ++I) { - Relations.emplace_back((unsigned)SymbolRole::RelationOverrideOf, *I); + for (const CXXMethodDecl *O : CXXMD->overridden_methods()) { + Relations.emplace_back((unsigned)SymbolRole::RelationOverrideOf, O); } } gatherTemplatePseudoOverrides(D, Relations); @@ -267,6 +266,10 @@ public: TypeNameInfo->getTypeLoc().getLocStart(), Dtor->getParent(), Dtor->getDeclContext()); } + } else if (const auto *Guide = dyn_cast<CXXDeductionGuideDecl>(D)) { + IndexCtx.handleReference(Guide->getDeducedTemplate()->getTemplatedDecl(), + Guide->getLocation(), Guide, + Guide->getDeclContext()); } // Template specialization arguments. if (const ASTTemplateArgumentListInfo *TemplateArgInfo = @@ -350,12 +353,10 @@ public: gatherTemplatePseudoOverrides(D, Relations); IndexCtx.indexTagDecl(D, Relations); } else { - auto *Parent = dyn_cast<NamedDecl>(D->getDeclContext()); SmallVector<SymbolRelation, 1> Relations; gatherTemplatePseudoOverrides(D, Relations); - return IndexCtx.handleReference(D, D->getLocation(), Parent, - D->getLexicalDeclContext(), - SymbolRoleSet(), Relations); + return IndexCtx.handleDecl(D, D->getLocation(), SymbolRoleSet(), + Relations, D->getLexicalDeclContext()); } } return true; @@ -607,6 +608,24 @@ public: SymbolRoleSet()); } + bool VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) { + TRY_DECL(D, IndexCtx.handleDecl(D)); + const DeclContext *DC = D->getDeclContext()->getRedeclContext(); + const NamedDecl *Parent = dyn_cast<NamedDecl>(DC); + IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), Parent, + D->getLexicalDeclContext()); + return true; + } + + bool VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D) { + TRY_DECL(D, IndexCtx.handleDecl(D)); + const DeclContext *DC = D->getDeclContext()->getRedeclContext(); + const NamedDecl *Parent = dyn_cast<NamedDecl>(DC); + IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), Parent, + D->getLexicalDeclContext()); + return true; + } + bool VisitClassTemplateSpecializationDecl(const ClassTemplateSpecializationDecl *D) { // FIXME: Notify subsequent callbacks if info comes from implicit @@ -644,7 +663,6 @@ public: } bool VisitTemplateDecl(const TemplateDecl *D) { - // FIXME: Template parameters. // Index the default values for the template parameters. const NamedDecl *Parent = D->getTemplatedDecl(); @@ -661,7 +679,7 @@ public: } else if (const auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(TP)) { if (TTPD->hasDefaultArgument()) handleTemplateArgumentLoc(TTPD->getDefaultArgument(), Parent, - /*DC=*/nullptr); + TP->getLexicalDeclContext()); } } } |