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

[Format] star/amp is incorrectly recognized as PointerOrReference when overloaded operator is called as a member function #49912

Closed
Nuullll opened this issue Jun 3, 2021 · 2 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla clang-format

Comments

@Nuullll
Copy link
Contributor

Nuullll commented Jun 3, 2021

Bugzilla Link 50568
Resolution FIXED
Resolved on Nov 15, 2021 23:55
Version trunk
OS All
Fixed by commit(s) rG873308fd8c96a54f0024251425daac1b78f70119

Extended Description

The '*' should be a binary operator.

// test.cpp
void f() { a.operator()(a * a); }

clang-format test.cpp --debug-only=format-token-annotator

AnnotatedTokens(L=0):
M=0 C=0 T=Unknown S=1 F=0 B=0 BK=0 P=0 Name=void L=4 PPK=2 FakeLParens= FakeRParens=0 II=0x278cf38 Text='void'
M=0 C=1 T=FunctionDeclarationName S=1 F=0 B=0 BK=0 P=80 Name=identifier L=6 PPK=2 FakeLParens= FakeRParens=0 II=0x2791e10 Text='f'
M=0 C=0 T=Unknown S=0 F=0 B=0 BK=0 P=23 Name=l_paren L=7 PPK=2 FakeLParens= FakeRParens=0 II=0x0 Text='('
M=0 C=0 T=Unknown S=0 F=0 B=0 BK=0 P=140 Name=r_paren L=8 PPK=2 FakeLParens= FakeRParens=0 II=0x0 Text=')'
M=0 C=0 T=FunctionLBrace S=1 F=0 B=0 BK=1 P=23 Name=l_brace L=10 PPK=2 FakeLParens= FakeRParens=0 II=0x0 Text='{'

AnnotatedTokens(L=1):
M=0 C=0 T=Unknown S=1 F=0 B=0 BK=0 P=0 Name=identifier L=1 PPK=2 FakeLParens=0/ FakeRParens=0 II=0x2791e40 Text='a'
M=0 C=1 T=Unknown S=0 F=0 B=0 BK=0 P=170 Name=period L=2 PPK=2 FakeLParens= FakeRParens=0 II=0x0 Text='.'
M=0 C=1 T=FunctionDeclarationName S=0 F=0 B=0 BK=0 P=220 Name=operator L=10 PPK=2 FakeLParens= FakeRParens=0 II=0x278d530 Text='operator'
M=0 C=0 T=OverloadedOperator S=0 F=0 B=0 BK=0 P=23 Name=l_paren L=11 PPK=2 FakeLParens= FakeRParens=0 II=0x0 Text='('
M=0 C=0 T=OverloadedOperator S=0 F=0 B=0 BK=0 P=59 Name=r_paren L=12 PPK=2 FakeLParens= FakeRParens=0 II=0x0 Text=')'
M=0 C=0 T=OverloadedOperatorLParen S=0 F=0 B=0 BK=0 P=23 Name=l_paren L=13 PPK=2 FakeLParens= FakeRParens=0 II=0x0 Text='('
M=0 C=1 T=Unknown S=0 F=0 B=0 BK=0 P=59 Name=identifier L=14 PPK=2 FakeLParens= FakeRParens=0 II=0x2791e40 Text='a'
M=0 C=1 T=PointerOrReference S=1 F=0 B=0 BK=0 P=230 Name=star L=16 PPK=2 FakeLParens= FakeRParens=0 II=0x0 Text='*'
M=0 C=1 T=StartOfName S=0 F=0 B=0 BK=0 P=240 Name=identifier L=17 PPK=2 FakeLParens= FakeRParens=0 II=0x2791e40 Text='a'
M=0 C=0 T=Unknown S=0 F=0 B=0 BK=0 P=43 Name=r_paren L=18 PPK=2 FakeLParens= FakeRParens=1 II=0x0 Text=')'
M=0 C=0 T=Unknown S=0 F=0 B=0 BK=0 P=23 Name=semi L=19 PPK=2 FakeLParens= FakeRParens=0 II=0x0 Text=';'

AnnotatedTokens(L=0):
M=0 C=0 T=Unknown S=1 F=0 B=0 BK=0 P=0 Name=r_brace L=1 PPK=2 FakeLParens= FakeRParens=0 II=0x0 Text='}'

AnnotatedTokens(L=0):
M=0 C=0 T=Unknown S=1 F=0 B=0 BK=0 P=0 Name=eof L=0 PPK=2 FakeLParens= FakeRParens=0 II=0x0 Text=''

void f() { a.operator()(a *a); }

@Nuullll
Copy link
Contributor Author

Nuullll commented Jun 3, 2021

assigned to @Nuullll

@Nuullll
Copy link
Contributor Author

Nuullll commented Jun 4, 2021

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 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 clang-format
Projects
None yet
Development

No branches or pull requests

1 participant