This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Store MacroInfo in CodeCompletionResult for macro results.
ClosedPublic

Authored by ioeric on Sep 5 2018, 2:52 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ioeric created this revision.Sep 5 2018, 2:52 AM
sammccall accepted this revision.Sep 5 2018, 6:40 AM
sammccall added inline comments.
include/clang/Sema/CodeCompleteConsumer.h
847 ↗(On Diff #163995)

Let's not make this maybe/optional: If the result is RK_Macro, information about the macro definition.
There's only one relevant constructor, with only 3 callsites (the two you have, and one in clangd), so we can fix them all.

One of them statically appears like it could be null sometimes, but dynamically should never be null for macros triggering code complete I think (we may want to add an assert).

875 ↗(On Diff #163995)

(so I'd drop the default argument here)

This revision is now accepted and ready to land.Sep 5 2018, 6:40 AM
ioeric updated this revision to Diff 164044.Sep 5 2018, 7:59 AM
  • update comment about missing MacroInfo.
include/clang/Sema/CodeCompleteConsumer.h
847 ↗(On Diff #163995)

As discussed offline, undefined macros do not have MacroInfo, and they can appear in sema results. Added this to comment.

This revision was automatically updated to reflect the committed changes.