[PATCH] D127873: [clang-format] Fix misplacemnt of `*` in declartion of pointer to struct
Björn Schäpers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 15 12:15:06 PDT 2022
HazardyKnusperkeks added a comment.
In D127873#3586475 <https://reviews.llvm.org/D127873#3586475>, @MyDeveloperDay wrote:
> what about (may not be useful but compiles)
>
> struct {
> int foo;
> } &&ptr2 = {};
>
> https://godbolt.org/z/rbb8x3hKP
Let's ask why it was set to a binary operator. What kind of code would want the binary operator after a closing brace? I can make up such code, but we basically have to decide which code is probably more in use, or make the detection more sophisticated.
================
Comment at: clang/unittests/Format/TokenAnnotatorTest.cpp:93
+ EXPECT_EQ(Tokens.size(), 10u) << Tokens;
+ EXPECT_TOKEN(Tokens[6], tok::star, TT_PointerOrReference);
}
----------------
MyDeveloperDay wrote:
> Can you add a verifyFormat test that shows what you want? as well
I think the annotator test is sufficient. Because it's just about annotating the token, formatting is secondary (and dependent on style - these tests are already in place).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127873/new/
https://reviews.llvm.org/D127873
More information about the cfe-commits
mailing list