[PATCH] D147377: [clang-format] Don't allow variable decls to have trailing return arrows
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 2 01:03:22 PDT 2023
owenpan added inline comments.
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:1922
} else if (Current.is(tok::arrow) && AutoFound &&
(Line.MustBeDeclaration || Line.InPPDirective) &&
Current.NestingLevel == 0 &&
----------------
It seems we can simply check if the line might be a function declaration here instead of resetting `AutoFound` below.
================
Comment at: clang/unittests/Format/TokenAnnotatorTest.cpp:1493
+
+ Tokens = annotate("auto foo() -> auto { return Val; }");
+ ASSERT_EQ(Tokens.size(), 12u) << Tokens;
----------------
Can this be valid C++?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147377/new/
https://reviews.llvm.org/D147377
More information about the cfe-commits
mailing list