This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Fix code completion of macros defined in the preamble region of the main file.
ClosedPublic

Authored by sammccall on Apr 20 2019, 10:18 AM.

Diff Detail

Event Timeline

sammccall created this revision.Apr 20 2019, 10:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2019, 10:18 AM
ilya-biryukov accepted this revision.May 2 2019, 1:55 AM

LGTM.

I suggest considering a more direct way to solve the same problem: we could collect symbols for the main-file macros when building the preamble and store them in PreambleData (or somewhere else with the same lifetime).
I don't see any reasons why the current approach won't work, though, so looks ok too.

unittests/clangd/CodeCompleteTests.cpp
2081 ↗(On Diff #195975)

are we missing # here?

This revision is now accepted and ready to land.May 2 2019, 1:55 AM
sammccall updated this revision to Diff 197734.May 2 2019, 3:31 AM

Record macro names while building preamble instead of lexing it later.

ilya-biryukov accepted this revision.May 2 2019, 3:47 AM

LGTM. Neat!

This revision was automatically updated to reflect the committed changes.

No worries, thanks for reverting.
I think this is just a bad assert, I'll fix it and reland.