[PATCH] D37140: [clang-format] Fixed one-line if statement

Pawel Maciocha via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 6 03:31:38 PDT 2017


PriMee added inline comments.


================
Comment at: lib/Format/UnwrappedLineFormatter.cpp:286
     }
+    if (TheLine->Last->is(tok::l_brace) &&
+        TheLine->First != TheLine->Last &&
----------------
PriMee wrote:
> krasimir wrote:
> > No tests fail if this `if` statement gets removed. Please either remove it or add a test for it.
> That's true. Why is that? Without this if statement tests would pass because our block would have been handled by the construct I have mentioned in problem description (Line 311). Adding a very similar test case with BraceWrapping.AfterFunction flag changed would show that we need this if statement. To my mind, it doesn't make sense to add such test case.
Okay, done. Now the test case would fail (Line 449 in FormatTest.cpp would be problematic, although in our case should NOT change anything).


https://reviews.llvm.org/D37140





More information about the cfe-commits mailing list