We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// Command line: c-index-test -test-load-source all file.cpp
struct A { int value; A & operator ++ () // preincrement { value += 1; return (*this); } A & operator ++ (int) // postincrement { value += 2; return (*this); } A & operator << (int rhs) { value = 23; return (*this); } };
A a;
The text was updated successfully, but these errors were encountered:
The underlying issue is that the ast nodes don't have locations:
void func() (CompoundStmt 0x7f918403dde0 <t.cpp:24:1, line:28:1> (CXXOperatorCallExpr 0x7f918403d100 <line:25:3, col:5> 'struct A' lvalue (ImplicitCastExpr 0x7f918403d0e8 <> 'struct A &()(void)' (DeclRefExpr 0x7f918403d090 <> 'struct A &(void)' lvalue CXXMethod 0x7f918403c430 'operator++' 'struct A &(void)')) (DeclRefExpr 0x7f918403d068 col:5 'struct A' lvalue Var 0x7f918403cbc0 'a' 'struct A')) (CXXOperatorCallExpr 0x7f918403dcd0 <line:26:3, col:4> 'struct A' lvalue (ImplicitCastExpr 0x7f918403dcb8 <> 'struct A &()(int)' (DeclRefExpr 0x7f918403dc68 <> 'struct A &(int)' lvalue CXXMethod 0x7f918403c5a0 'operator++' 'struct A &(int)')) (DeclRefExpr 0x7f918403d138 col:3 'struct A' lvalue Var 0x7f918403cbc0 'a' 'struct A') (IntegerLiteral 0x7f918403d160 <> 'int' 0)) (CXXOperatorCallExpr 0x7f918403dda0 <line:27:3, col:8> 'struct A' lvalue (ImplicitCastExpr 0x7f918403dd88 <col:5, > 'struct A &(*)(int)' (DeclRefExpr 0x7f918403dd60 <col:5, > 'struct A &(int)' lvalue CXXMethod 0x7f918403c6e0 'operator<<' 'struct A &(int)')) (DeclRefExpr 0x7f918403dd10 col:3 'struct A' lvalue Var 0x7f918403cbc0 'a' 'struct A') (IntegerLiteral 0x7f918403dd38 col:8 'int' 23)))
Sorry, something went wrong.
Cloned to rdar://problem/10324915 [#11192 ] Invocation of operator ++ does not get a location
Fixed in r150033
No branches or pull requests
Extended Description
If you run this you can see that the invocations of operator ++ gets while operator << has a valid location
// Command line: c-index-test -test-load-source all file.cpp
struct A
{
int value;
A & operator ++ () // preincrement
{
value += 1;
return (*this);
}
A & operator ++ (int) // postincrement
{
value += 2;
return (*this);
}
A & operator << (int rhs)
{
value = 23;
return (*this);
}
};
A a;
void func (void)
{
++a; // CHECK: :0:0: DeclRefExpr=operator++:6:7
a++; // CHECK: :0:0: DeclRefExpr=operator++:11:7
a << 23; // CHECK: file.cpp:29:5: DeclRefExpr=operator<<:16:7
}
The text was updated successfully, but these errors were encountered: