I think that's the best we can do. Even if the range had the beginning before 
the end (say, by trying to highlight the entirety of both macros), it wouldn't 
be "correct".  We should not show ranges that don't correspond to something 
meaningful in the text.

...though arguably we could show a line with all macros expanded, and put the 
range there. But that's a big change in what you expect from diagnostic 
printing, and it wouldn't work in IDEs anyway.

Jordan


On Oct 24, 2012, at 19:36 , Eli Friedman <[email protected]> wrote:

> Patch attached.  Fixes a crash on a testcase like the following:
> 
> +#define BAD_CONDITIONAL_OPERATOR (2<3)?4:5
> +int x = BAD_CONDITIONAL_OPERATOR+BAD_CONDITIONAL_OPERATOR;
> 
> We try to print a source range which starts at the 5 in the first
> expansion, and ends just after the 3 in the second expansion. This
> causes an assertion failure in diagnostic emission because the
> beginning of the range appears to be after the end.
> 
> My attempted fix is to try to suppress printing source ranges when the
> beginning and end point into different macro expansions (even if the
> physical locations happen to be on the same line).  I'm not confident
> this is the correct fix, but it seems to be roughly on the right
> track.  Any comments welcome.
> 
> (This is <rdar://problem/12472249>.)
> 
> -Eli
> <sourcerange_assert.txt>_______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

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

Reply via email to