[cfe-dev] Clang: get list of defined macro

Manuel Klimek klimek at google.com
Tue Oct 30 01:45:35 PDT 2012


On Mon, Oct 29, 2012 at 7:28 PM, GabrieleCocco <cocco at di.unipi.it> wrote:

> I think I found out something for my purpose. The macro should be
> CLVM_DEBUG.
>
>         IdentifierInfo& info = Context.Idents.get("CLVM_DEBUG");
>         if(info.hasMacroDefinition()) {
>             ...
>         }
>

That looks correct.


>         else {
>              // Find SourceLocation of the first/last #define and add
> CLVM_DEBUG definition
>         }
>
> Is it safe to do this?
> I'm still wondering how to implement the else branch.
>

Well, that seems not solvable in general, but in a code base that has some
style rules, it might be solvable "well enough".

Cheers,
/Manuel


>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/Clang-get-list-of-defined-macro-tp4027815p4027816.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121030/07e384b0/attachment.html>


More information about the cfe-dev mailing list