Skip to content
New issue

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

Invocation of operator ++ does not get a location #11564

Closed
llvmbot opened this issue Oct 20, 2011 · 3 comments
Closed

Invocation of operator ++ does not get a location #11564

llvmbot opened this issue Oct 20, 2011 · 3 comments
Labels
bugzilla Issues migrated from bugzilla c++

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Oct 20, 2011

Bugzilla Link 11192
Resolution FIXED
Resolved on Feb 07, 2012 20:35
Version trunk
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @akyrtzi,@DougGregor,@tkremenek

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
}

@akyrtzi
Copy link
Contributor

akyrtzi commented Oct 20, 2011

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)))

@akyrtzi
Copy link
Contributor

akyrtzi commented Oct 21, 2011

Cloned to rdar://problem/10324915 [#11192 ] Invocation of operator ++ does not get a location

@akyrtzi
Copy link
Contributor

akyrtzi commented Feb 8, 2012

Fixed in r150033

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++
Projects
None yet
Development

No branches or pull requests

2 participants