[cfe-commits] r132247 - in /cfe/trunk: include/clang/Basic/SourceManager.h lib/Basic/SourceManager.cpp

Argyrios Kyrtzidis akyrtzi at gmail.com
Sat May 28 14:02:56 PDT 2011

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

> On Sat, May 28, 2011 at 12:45 AM, Abramo Bagnara
> <abramo.bagnara at gmail.com> 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..

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110528/7c68d4b2/attachment.html>

More information about the cfe-commits mailing list