[cfe-dev] [patch] Fix source range of CXXNewExprs

John McCall rjmccall at apple.com
Wed Nov 17 15:29:52 PST 2010


On Nov 17, 2010, at 3:22 PM, Nico Weber wrote:

> Hi,
> 
> the attached patch fixes the source range on CXXNewExprs. For code like
> 
>  foo:A* a = new foo::A;
> 
> the CXXNewExpr's source range's end would point to `foo` instead of
> `A`. This was because Sema::BuildCXXNew() uses the allocated type's
> TypeLoc's source range's end as end location for CXXNewExpr if no
> parens are present (new foo::A() is handled correctly already), and
> TypeSpecTypeLoc has only a start location.

This should be an ElaboratedTypeLoc.  If it isn't, that's the bug, not changing
TypeSpecTypeLoc.

John.



More information about the cfe-dev mailing list