Page MenuHomePhabricator

[clangd] Don't insert extra namespace qualifiers when Sema gets lost.
ClosedPublic

Authored by sammccall on Apr 10 2019, 4:43 AM.

Details

Summary

There are cases where Sema can't tell that "foo" in foo::Bar is a
namespace qualifier, like in incomplete macro expansions.

After this patch, if sema reports no specifier but it looks like there's one in
the source code, then we take it into account.

Reworked structure and comments in getQueryScopes to try to fight
creeping complexity - unsure if I succeeded.

I made the test harder (the original version also passes).

Diff Detail

Repository
rL LLVM

Event Timeline

sammccall created this revision.Apr 10 2019, 4:43 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2019, 4:43 AM
sammccall updated this revision to Diff 194486.Apr 10 2019, 4:45 AM

Update comment

sammccall marked an inline comment as done.Apr 10 2019, 4:56 AM
sammccall added inline comments.
clangd/CodeComplete.cpp
545 ↗(On Diff #194486)

(AFAICT this lambda was executed the same way on every code path, so I just inlined it)

ioeric accepted this revision.Apr 10 2019, 6:31 AM

Feel free to land this. I'll rebase D60126 on this when it's in.

clangd/CodeComplete.cpp
580 ↗(On Diff #194486)

nit: Sema Specifier can't be nullptr at this point.

This revision is now accepted and ready to land.Apr 10 2019, 6:31 AM
sammccall marked an inline comment as done.Apr 10 2019, 8:13 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2019, 8:15 AM