ExprLoc of ArraySubscriptExpr wrong?

I have an ArraySubscriptExpr that looks like this:


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.

Is this a bug?


I agree that that location didn't make a lot of sense. I changed it here:

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.