[cfe-dev] ExprLoc of ArraySubscriptExpr wrong?
Chris Lattner
clattner at apple.com
Tue Jan 13 13:14:15 PST 2009
On Jan 13, 2009, at 10:38 AM, Alexei Svitkine wrote:
> I have an ArraySubscriptExpr that looks like this:
>
> argv[0];
>
> Which becomes to:
>
> (ArraySubscriptExpr 0x1c06d70 'char *'
> (DeclRefExpr 0x1c06d30 'char **' ParmVar='argv' 0x1c06c50)
> (IntegerLiteral 0x1c06d50 'int' 0))
>
> When I call getExprLoc().getRawFilePos() on this, I get the location
> that corresponds to the "]" in argv[0]; which seems inconsistent with
> other Exprs which give the start the of the expression instead.
I agree that that location didn't make a lot of sense. I changed it
here:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090112/010814.html
However, note that this API is pretty poorly defined. I'd strongly
prefer to change the existing clients of it to pass up a reasonable
location in their recursive walk when possible, and use that instead.
In other words, wouldn't suggest building on this API.
-Chris
More information about the cfe-dev
mailing list