Bug 1478097 - Update indexer to visit implicit code inside constructors. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D2461

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kartikaya Gupta 2018-07-27 16:05:26 +00:00
Родитель 33f8e97d97
Коммит 7d34b79e90
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -158,8 +158,9 @@ private:
// Tracks the set of declarations that the current expression/statement is
// nested inside of.
struct AutoSetContext {
AutoSetContext(IndexConsumer *Self, NamedDecl *Context)
AutoSetContext(IndexConsumer *Self, NamedDecl *Context, bool VisitImplicit = false)
: Self(Self), Prev(Self->CurDeclContext), Decl(Context) {
this->VisitImplicit = VisitImplicit || (Prev ? Prev->VisitImplicit : false);
Self->CurDeclContext = this;
}
@ -168,6 +169,7 @@ private:
IndexConsumer *Self;
AutoSetContext *Prev;
NamedDecl *Decl;
bool VisitImplicit;
};
AutoSetContext *CurDeclContext;
@ -571,7 +573,7 @@ public:
return Super::TraverseCXXMethodDecl(D);
}
bool TraverseCXXConstructorDecl(CXXConstructorDecl *D) {
AutoSetContext Asc(this, D);
AutoSetContext Asc(this, D, true);
const FunctionDecl *Def;
// See TraverseFunctionDecl.
if (TemplateStack && D->isDefined(Def) && Def && D != Def) {
@ -796,6 +798,11 @@ public:
return false;
}
bool shouldVisitImplicitCode() const {
AutoSetContext *Ctxt = CurDeclContext;
return Ctxt ? Ctxt->VisitImplicit : false;
}
bool TraverseClassTemplateDecl(ClassTemplateDecl *D) {
AutoTemplateContext Atc(this);
Super::TraverseClassTemplateDecl(D);