[cfe-dev] #undefine cursors

Matthieu Monrocq matthieu.monrocq at gmail.com
Sat Nov 3 06:43:59 PDT 2012


On Fri, Nov 2, 2012 at 10:34 PM, Iestyn Bleasdale-Shepherd <
iestyn at valvesoftware.com> wrote:

>  Hi,
>
> When using the libclang API, ‘#define’ statements yield cursors, but
> ‘#undefine’ statements do not.
>
> Without a record of #undefines, I can’t determine which #defines are
> extant at any given point in the code, and am thus unable to fully
> determine dependencies between source files.
>
> Is it possible to determine which #defines are active for a given source
> location, or would the addition of #undefine cursors be a reasonable
> feature request for the libclang API?
>
>
> Thanks!
>
> iestyn Bleasdale-Shepherd
>
>
>
Well, you are lucky in that a good chunk of work went on recently into what
was called "Macro History" whose goal is exactly to remember every single
#define/#undef that a macro encountered in the pre-processing of the
translation unit. Therefore, using this macro history, it should be
possible to extract this information.

Unfortunately, I do not know the exact API, Alexander Kornienko initiated
the work on this, so he probably followed it, I have added him in CC so he
can help us figure out exactly where this feature stands.

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121103/07d3b5e7/attachment.html>


More information about the cfe-dev mailing list