Bug 1931631 - C++ indexer should treat constructor member initializer list field uses as having a contextsym of the constructor

This is propagating the upstream
https://github.com/mozsearch/mozsearch/pull/835 which was reviewed by
:arai.

Differential Revision: https://phabricator.services.mozilla.com/D229242
This commit is contained in:
Andrew Sutherland 2024-11-16 21:21:11 +00:00
parent a484f2eaab
commit bb9798ff28

View File

@ -2393,8 +2393,13 @@ public:
FieldDecl *Member = Ci->getMember();
std::string Mangled = getMangledName(CurMangleContext, Member);
// We want the constructor to be the context of the field use and
// `getContext(D)` would skip the current context. An alternate approach
// would be `getContext(Loc)` but the heuristic to omit a context if we're
// in a macro body expansion seems incorrect for field initializations; if
// code is using macros to initialize the fields, we still care.
visitIdentifier("use", "field", getQualifiedName(Member), Loc, Mangled,
Member->getType(), getContext(D));
Member->getType(), translateContext(D));
}
return true;