[PATCH] D69241: [clangd] Handle the missing constructor initializers in findExplicitReferences.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 22 06:28:49 PDT 2019
hokein marked an inline comment as done.
hokein added inline comments.
================
Comment at: clang-tools-extra/clangd/FindTarget.cpp:677
if (const CXXCtorInitializer *CCI = N.get<CXXCtorInitializer>()) {
- if (CCI->isBaseInitializer())
- return refInTypeLoc(CCI->getBaseClassLoc());
- assert(CCI->isAnyMemberInitializer());
- return {ReferenceLoc{NestedNameSpecifierLoc(),
- CCI->getMemberLocation(),
- /*IsDecl=*/false,
- {CCI->getAnyMember()}}};
+ // Other type initializers (e.g. base initializer) are handled by visiting
+ // the typeLoc.
----------------
ilya-biryukov wrote:
> hokein wrote:
> > ilya-biryukov wrote:
> > > I believe base initializers are the only ones left, but the comment suggests there are more cases. Maybe change to:
> > > ```
> > > // Base initializers are handled by visting the type loc.
> > > ```
> > > Or am I missing something?
> > >
> > there are others, delegating initializers.
> Ah, interesting... Could we add them to the tests too?
it has been added in the tests already, without the change here, the test will trigger the `assert(CCI->isAnyMemberInitializer());`.
```
// delegating initializer
class $10^Foo {
$11^Foo(int$12^);
$13^Foo(): $14^Foo(111) {}
};
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69241/new/
https://reviews.llvm.org/D69241
More information about the cfe-commits
mailing list