[PATCH] Fix missing source location in CXXTemporaryObjectExpr.

Enea Zaffanella zaffanella at cs.unipr.it
Wed Sep 4 04:24:27 PDT 2013


When dumping the following C++11 chunk of code

$ cat chunk.cc
struct A { A(int, int); };
A a_paren( A(0,0) );
A a_range( A{0,0} );

the CXXTemporaryObjectExpr generated by A{0,0}
is missing a proper end location
(the source location is correctly set for A(0,0)).

$ clang -cc1 -std=c++11 -ast-dump chunk.cc
[...]
`-VarDecl 0x5a963e0 <line:3:1, col:19> a_range 'struct A'
   `-CXXConstructExpr 0x5a96570 <col:3, col:19> 'struct A' 'void (struct 
A &&) noexcept' elidable
     `-MaterializeTemporaryExpr 0x5a96550 <col:12, <invalid sloc>> 
'struct A' xvalue
       `-CXXTemporaryObjectExpr 0x5a964d8 <col:12, <invalid sloc>> 
'struct A' 'void (int, int)'
         |-IntegerLiteral 0x5a96448 <col:14> 'int' 0
         `-IntegerLiteral 0x5a96468 <col:16> 'int' 0


Please find attached a patch (with testcase) fixing this issue.
OK to commit?

Enea.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CXXTempObjExpr.patch
Type: text/x-diff
Size: 3768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130904/f70a137c/attachment.patch>


More information about the cfe-commits mailing list