[LLVMbugs] [Bug 9168] Wrong source location for CXXMemberCallExpr
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Jul 10 15:23:35 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9168
Chandler Carruth <chandlerc at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
CC| |chandlerc at gmail.com
Resolution| |FIXED
--- Comment #7 from Chandler Carruth <chandlerc at gmail.com> 2011-07-10 17:23:34 CDT ---
(In reply to comment #6)
> I have synced to 127127 now. I see the same issue with CXXOperatorCallExpr.
>
> obj->method(arg)
> ^
> getLocStart() for CXXOperatorCallExpr
>
>
> obj->method(arg)
> ^ getLocStart() for MemberExpr
>
> Thus the start location of sub expression is before the start location of the
> encompassing expression.
Sorry for the very late response, but I tried this morning (r134880) to
reproduce this using the AST dump feature of Clang (as it prints
Stmt::getSourceRange for each expression node) and the behavior looks correct:
% cat x.cc
struct X {
struct Y {
void operator ()(int) {}
} y;
};
struct S {
X* operator->() { return new X; }
};
void test(S s) {
s->y(42);
}
% ./bin/clang -cc1 -ast-dump x.cc
<snip lots of irrelevant stuff...>
void test(S s) (CompoundStmt 0x54021c8 <x.cc:10:16, line:12:1>
(CXXOperatorCallExpr 0x5402160 <line:11:3, col:10> 'void'
(ImplicitCastExpr 0x5402148 <<invalid sloc>> 'void (*)(int)'
<FunctionToPointerDecay>
(DeclRefExpr 0x54020f8 <<invalid sloc>> 'void (int)' lvalue CXXMethod
0x53fe8b0 'operator()' 'void (int)'))
(MemberExpr 0x5402098 <col:3, col:6> 'struct Y':'struct X::Y' lvalue ->y
0x53fe9a0
(CXXOperatorCallExpr 0x5402060 <col:3> 'struct X *'
(ImplicitCastExpr 0x5402048 <<invalid sloc>> 'struct X *(*)(void)'
<FunctionToPointerDecay>
(DeclRefExpr 0x5401ff8 <<invalid sloc>> 'struct X *(void)' lvalue
CXXMethod 0x53fece0 'operator->' 'struct X *(void)'))
(DeclRefExpr 0x5401fa0 <col:3> 'struct S' lvalue ParmVar 0x5401e40 's'
'struct S')))
(IntegerLiteral 0x54020d0 <col:8> 'int' 42)))
Specifically, CXXOperatorCallExpr starts on column 3, as does the MemberExpr,
and the inner CXXOperatorCallExpr (for the -> operator). Please open a new bug
if you see further inconsistencies in source locations, and include the sample
code and ast dump that hightlights it (if possible to see the problem in ast
dump).
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list