[PATCH] D114859: [clang-format] Add better support for co-routinues
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 1 09:11:05 PST 2021
MyDeveloperDay added inline comments.
================
Comment at: clang/unittests/Format/FormatTest.cpp:22727
+
+TEST_F(FormatTest, CoRoutineawait) {
+ verifyFormat("int x = co_await foo();");
----------------
Quuxplusone wrote:
>
naming of the tests is to allow easy running of all CoRoutine tests
`./FormatTests --gtest_filter=*CoRoutine*`
================
Comment at: clang/unittests/Format/FormatTest.cpp:22731
+ verifyFormat("co_await (42);");
+ verifyFormat("void operator co_await(int);");
+ verifyFormat("co_await a;");
----------------
Quuxplusone wrote:
> just to make sure the name `int` isn't being treated as magic by clang-format
I'd like to add this, sometimes its nice to have tests which might traditionally challenge the code to behave reasonable even if the syntax is invalid
================
Comment at: clang/unittests/Format/FormatTest.cpp:22756
+ verifyFormat("co_yield 42;");
+ verifyFormat("co_yield n++;");
+}
----------------
Quuxplusone wrote:
> IIRC, before we lexed `co_yield` as a keyword, we used to do `co_yield++ n;`. I don't see any way for `co_yield n++;` to get misformatted, though: `co_yieldn++;` would obviously never happen.
let add both ways around to ensure its behaving.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114859/new/
https://reviews.llvm.org/D114859
More information about the cfe-commits
mailing list