[PATCH] D34225: [clang-format] Teach clang-format how to handle C++ coroutines

Daniel Jasper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 11 22:10:22 PDT 2017


djasper added inline comments.


================
Comment at: lib/Format/TokenAnnotator.cpp:2267
+      return true;
+    if (Right.is(tok::l_paren) && Left.is(tok::kw_co_await) &&
+        Left.Previous && Left.Previous->is(tok::kw_operator))
----------------
EricWF wrote:
> djasper wrote:
> > I know that the split between spaceRrequiredBefore and spaceRequiredBetween is generally bad. However, here you seem to be testing the exact same thing that is then retested in spaceRequiredBetween. I'd prefer the logic to be in one place only. Which tests break if you remove the changes to spaceRequiredBetween?
> > Which tests break if you remove the changes to spaceRequiredBetween?
> 
> Not sure I have a test, I was probably mistaken adding this.
> 
> @djasper Assuming only one set of changes is needed, would they be better in `spaceRequiredBetween` or `spaceRequiredBefore`?
I don't know that I have a good answer to that. But I'd leave it here in the C++ language specific part.


https://reviews.llvm.org/D34225





More information about the cfe-commits mailing list