[all-commits] [llvm/llvm-project] 9512d6: [clang-format] Fix parsing of `operator<() {}` (#7...
XDeme via All-commits
all-commits at lists.llvm.org
Wed Dec 13 11:58:10 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9512d6d2133a15a3e6272cbadd7fbb479011ccdb
https://github.com/llvm/llvm-project/commit/9512d6d2133a15a3e6272cbadd7fbb479011ccdb
Author: XDeme <66138117+XDeme at users.noreply.github.com>
Date: 2023-12-13 (Wed, 13 Dec 2023)
Changed paths:
M clang/lib/Format/TokenAnnotator.cpp
M clang/unittests/Format/TokenAnnotatorTest.cpp
Log Message:
-----------
[clang-format] Fix parsing of `operator<() {}` (#75144)
Fixes #74876.
During the parsing of `operator<(Foo&) {}`, there was no handling for
the operator<, so it called `consumeToken()` again, causing the
`AnnotationParser::Scopes` to have one additional left brace each time
it tried to parse it, leaving it unbalanced.
Because of this, in the following code:
```cpp
class Foo {
void operator<(Foo&) {}
Foo& f;
};
```
The `&` in the reference member, was being interpreted as
`TT_BinaryOperator` instead of `TT_PointerOrReference`.
More information about the All-commits
mailing list