On May 28, 2011, at 12:50 AM, Chandler Carruth wrote:

> On Sat, May 28, 2011 at 12:45 AM, Abramo Bagnara
> <[email protected]> wrote:
>> This is *very* useful!
>> 
>> Using similar technique do you think it is feasible to do an helper that
>> permit to know if a macro token is at start/end of a macro argument?
> 
> Before you start touching macro argument source locations, please look
> at P9279 and my last patch. I'm working on the final benchmarks to
> validate that this doesn't cause major performance problems for
> typical code. Hopefully I'll get that checked in this weekend, but I
> thought that the last time I rotated around to work on that....

> % ./new/clang -fsyntax-only t6.cc
> t6.cc:5:1: error: expected unqualified-id
> M3(1, M0(2), 3);
>          ^
> t6.cc:1:15: note: instantiated from:
> #define M0(x) x
>               ^
> t6.cc:4:27: note: instantiated from:
> #define M3(x, y, z) M2(x, y, z)
>                           ^
> t6.cc:3:27: note: instantiated from:
> #define M2(x, y, z) M1(x, y, z)
>                           ^
> t6.cc:2:21: note: instantiated from:
> #define M1(x, y, z) y
>                     ^
> 1 error generated.
That is some serious diagnostic quality improvement, kudos Chandler!

That said I think we can get the same effect without storing extra source 
locations, I'll look into it more..

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to