Index: cfe/trunk/include/clang/Index/IndexingAction.h =================================================================== --- cfe/trunk/include/clang/Index/IndexingAction.h +++ cfe/trunk/include/clang/Index/IndexingAction.h @@ -39,6 +39,7 @@ SystemSymbolFilterKind SystemSymbolFilter = SystemSymbolFilterKind::DeclarationsOnly; bool IndexFunctionLocals = false; + bool IndexImplicitInstantiation = false; }; /// Creates a frontend action that indexes all symbols (macros and AST decls). Index: cfe/trunk/lib/Index/IndexDecl.cpp =================================================================== --- cfe/trunk/lib/Index/IndexDecl.cpp +++ cfe/trunk/lib/Index/IndexDecl.cpp @@ -726,7 +726,7 @@ if (D->isImplicit() && shouldIgnoreIfImplicit(D)) return true; - if (isTemplateImplicitInstantiation(D)) + if (isTemplateImplicitInstantiation(D) && !shouldIndexImplicitInstantiation()) return true; IndexingDeclVisitor Visitor(*this); Index: cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp =================================================================== --- cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp +++ cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp @@ -129,7 +129,7 @@ template bool HandleTemplateSpecializationTypeLoc(TypeLocType TL) { if (const auto *T = TL.getTypePtr()) { - if (IndexCtx.shouldIndexImplicitTemplateInsts()) { + if (IndexCtx.shouldIndexImplicitInstantiation()) { if (CXXRecordDecl *RD = T->getAsCXXRecordDecl()) IndexCtx.handleReference(RD, TL.getTemplateNameLoc(), Parent, ParentDC, SymbolRoleSet(), Relations); Index: cfe/trunk/lib/Index/IndexingContext.h =================================================================== --- cfe/trunk/lib/Index/IndexingContext.h +++ cfe/trunk/lib/Index/IndexingContext.h @@ -60,9 +60,7 @@ bool shouldIndexFunctionLocalSymbols() const; - bool shouldIndexImplicitTemplateInsts() const { - return false; - } + bool shouldIndexImplicitInstantiation() const; static bool isTemplateImplicitInstantiation(const Decl *D); Index: cfe/trunk/lib/Index/IndexingContext.cpp =================================================================== --- cfe/trunk/lib/Index/IndexingContext.cpp +++ cfe/trunk/lib/Index/IndexingContext.cpp @@ -37,6 +37,10 @@ return IndexOpts.IndexFunctionLocals; } +bool IndexingContext::shouldIndexImplicitInstantiation() const { + return IndexOpts.IndexImplicitInstantiation; +} + bool IndexingContext::handleDecl(const Decl *D, SymbolRoleSet Roles, ArrayRef Relations) {