[PATCH] D49002: [Index] Add index::IndexingOptions::IndexImplicitInstantiation
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 9 14:54:12 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL336606: [Index] Add index::IndexingOptions::IndexImplicitInstantiation (authored by MaskRay, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D49002?vs=154337&id=154704#toc
Repository:
rL LLVM
https://reviews.llvm.org/D49002
Files:
cfe/trunk/include/clang/Index/IndexingAction.h
cfe/trunk/lib/Index/IndexDecl.cpp
cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp
cfe/trunk/lib/Index/IndexingContext.cpp
cfe/trunk/lib/Index/IndexingContext.h
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/IndexTypeSourceInfo.cpp
===================================================================
--- cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp
+++ cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp
@@ -129,7 +129,7 @@
template<typename TypeLocType>
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/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/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<SymbolRelation> Relations) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49002.154704.patch
Type: text/x-patch
Size: 2685 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180709/9cdbebcb/attachment.bin>
More information about the cfe-commits
mailing list