This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix namespace aliases in findExplicitReferences
ClosedPublic

Authored by ilya-biryukov on Oct 30 2019, 9:50 AM.

Diff Detail

Event Timeline

ilya-biryukov created this revision.Oct 30 2019, 9:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 30 2019, 9:50 AM

Build result: pass - 59703 tests passed, 0 failed and 762 were skipped.
Log files: console-log.txt, CMakeCache.txt

kadircet accepted this revision.Oct 31 2019, 1:02 AM

This looks good, but it is missing the context. I suppose we were previously not providing any references for namespace aliases, because we were filtering both the alias and the underlying decl?
Could you update the revision summary and/or commit message ?

clang-tools-extra/clangd/unittests/FindTargetTests.cpp
893

nit: I suppose this line checks we are not regressing the "non-alias case", but they are already being tested in previous tests.

This revision is now accepted and ready to land.Oct 31 2019, 1:02 AM

As discussed offline, it might make more sense to fix this in targetDecls itself. Considering how the Alias is handled for typedefs and usings, it feels like this is a mistake for namespace aliases to be marked in that way.

ilya-biryukov marked 2 inline comments as done.Oct 31 2019, 4:00 AM

As discussed offline, it might make more sense to fix this in targetDecls itself. Considering how the Alias is handled for typedefs and usings, it feels like this is a mistake for namespace aliases to be marked in that way.

I took another look and it appears the typedefs also have the Alias relation set. So targetDecl is consistent there and the current fix seems ok.

clang-tools-extra/clangd/unittests/FindTargetTests.cpp
893

Yeah, that's just validating that non-aliases also work properly and that's definitely redundant.
I'll keep it as is, it doesn't seem to cause too much noise.

This revision was automatically updated to reflect the committed changes.
ilya-biryukov marked an inline comment as done.