[PATCH] D52098: [Index] Add an option to collect macros from preprocesor.
Eric Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 18 01:13:45 PDT 2018
ioeric added inline comments.
================
Comment at: unittests/Index/IndexTests.cpp:61
+ S.Roles = Roles;
+ if (MI)
+ S.Info = getSymbolInfoForMacro(*MI);
----------------
ilya-biryukov wrote:
> ioeric wrote:
> > ilya-biryukov wrote:
> > > Can this actually happen? It seems weird to have a macro occurrence without a `MacroInfo`.
> > > Maybe try asserting that MI is non-null instead?
> > this can happen for macros that are #undefined. Not relevant anymore.
> Ah, makes sense, thanks.
> Any reason to not report those? It looks like a valuable information (e.g. to avoid showing undefined macros in code completion).
I don't think this is a bug e.g. SemaCodeCompletion can intentionally show undefined macros in some contexts. It's up to the index consumer implementations how to handle undefinitions.
Repository:
rC Clang
https://reviews.llvm.org/D52098
More information about the cfe-commits
mailing list