[cfe-dev] Using clang reporting for a clang-tool

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Mar 18 12:49:54 PDT 2013


On Mar 8, 2013, at 12:12 PM, Armand Leclercq <marman.email at gmail.com> wrote:

> I have another question.
> 
> I am currently using PPCallbacks in order to check coding-style in macros.
> In order to do so, I'm using MacroDefined callback and I correctly get
> the macro name, but I cannot figure out how to get the macro arguments
> locations.
> 
> I get the macro argument string with
> clang::MacroInfo::arg_begin()::getNameStart()
> 
> And then, I can figure out the offset with the getLength() method, but
> it cannot help me to handle correctly the following example :
> 
> #define MAX(Arg,  Arg)
> #define MAX(Arg, Arg)

We don't keep track of the argument locations.

We could either:
1) Store the argument source locations in MacroInfo
2) Lazily re-lex and cache the argument locations of a MacroInfo when they are requested.

I personally am leaning towards 2) since the argument locations don't have any use for the compiler currently.

Are you interested in working on a patch ?

> 
> -- 
> Armand Leclercq
> EPITA 2013 Assistant C/Unix
> _______________________________________________
> 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/20130318/e07d442e/attachment.html>


More information about the cfe-dev mailing list