[cfe-dev] SourceLocations for faux subexpressions of CXXForRangeStmt
Abramo Bagnara
abramo.bagnara at gmail.com
Wed Oct 5 00:05:16 PDT 2011
Il 05/10/2011 07:15, Ted Kremenek ha scritto:
> I recently did an AST dump of CXXForRangeStmt, which led to the discover that the "faux" expressions representing the semantics of this statement have actual SourceLocations:
>
> (CXXForRangeStmt 0x7fb8db83dad8 <line:4:3, col:34>
> (DeclStmt 0x7fb8db83d5a8 <col:17>
> 0x7fb8db83d3a0 "auto int (&&__range)[2] =
> (DeclRefExpr 0x7fb8db83d260 <col:17> 'int [2]' lvalue Var 0x7fb8db83d030 'array' 'int [2]')")
> (DeclStmt 0x7fb8db83d8e8 <col:15>
> 0x7fb8db83d600 "auto int *__begin =
> (ImplicitCastExpr 0x7fb8db83d7c0 <col:15> 'int *' <ArrayToPointerDecay>
> ...
>
> I'm trying to understand why we would do this, as this could possibly pose problems with clients that want to reason about how the source was actually written. These expressions don't actually appear in the source. Should they even have valid SourceLocations?
IMHO locations for generated nodes should point to generating nodes
(just like template instantiations).
More information about the cfe-dev
mailing list