-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description

https://godbolt.org/z/d3WeT6d7W
As you can see, clang gives same source location for all function in method chaining. But GCC and MSVC gives different and actually better results.
After checking AST
-FunctionDecl <line:11:1, line:17:1> line:11:5 main 'int ()'
`-CompoundStmt <col:12, line:17:1>
`-ExprWithCleanups <line:12:5, line:16:13> 'X' lvalue
`-CXXMemberCallExpr <line:12:5, line:16:13> 'X' lvalue
|-MemberExpr <line:12:5, line:16:9> '<bound member function type>' .foo 0xe8a7ac0
| `-CXXMemberCallExpr <line:12:5, line:15:13> 'X' lvalue
| |-MemberExpr <line:12:5, line:15:9> '<bound member function type>' .foo 0xe8a7ac0
| | `-CXXMemberCallExpr <line:12:5, line:14:13> 'X' lvalue
| | |-MemberExpr <line:12:5, line:14:9> '<bound member function type>' .foo 0xe8a7ac0
| | | `-CXXMemberCallExpr <line:12:5, line:13:13> 'X' lvalue
| | | |-MemberExpr <line:12:5, line:13:9> '<bound member function type>' .foo 0xe8a7ac0
| | | | `-MaterializeTemporaryExpr <line:12:5, col:7> 'X' xvalue
| | | | `-CXXFunctionalCastExpr <col:5, col:7> 'X' functional cast to X <NoOp>
| | | | `-InitListExpr <col:6, col:7> 'X'
I think just using the end location of CXXMemberCallExpr rather than begin location can resolve the problem.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"