Reverts 4986f3f2f220 (but keeps its unit tests) and fixes #49973 differently.
Also fixes bugs that incorrectly annotate the operator keyword as TT_FunctionDeclarationName in function calls and as TT_Unknown in function declarations and definitions.
Paths
| Differential D154184
[clang-format] Correctly annotate */&/&& in operator function calls ClosedPublic Authored by owenpan on Jun 29 2023, 11:28 PM.
Details Summary Reverts 4986f3f2f220 (but keeps its unit tests) and fixes #49973 differently. Also fixes bugs that incorrectly annotate the operator keyword as TT_FunctionDeclarationName in function calls and as TT_Unknown in function declarations and definitions.
Diff Detail
Event TimelineHerald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptJun 29 2023, 11:29 PM Comment Actions Thanks, this probably makes more sense than what I did before
This revision is now accepted and ready to land.Jun 30 2023, 4:57 AM
This revision was landed with ongoing or failed builds.Jul 3 2023, 5:49 PM Closed by commit rG3f3620e5c9ee: [clang-format] Correctly annotate */&/&& in operator function calls (authored by owenpan). · Explain Why This revision was automatically updated to reflect the committed changes. Comment Actions It looks like this causes a regression in the following example: % cat test.cc struct A { std::unique_ptr<B> operator()(const B& b) const; }; % clang-format -style=google test.cc # should be the same as the input struct A { std::unique_ptr<B> operator()(const B & b) const; }; @owenpan, I was planning to temporarily revert this until you have a chance to look into this. Comment Actions
Ah, I missed that. That fixes it. Thank you! Comment Actions
nice catch @rymiel!
Revision Contents
Diff 536919 clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTest.cpp
clang/unittests/Format/TokenAnnotatorTest.cpp
|
I assume this extra fixup step means that the context of the call's parens won't be set to IsExpression = true? That won't cause any problems?