[PATCH] D66662: [clang-format] [PR43100] clang-format C# support does not add a space between "using" and paren

Owen Pan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 23:56:26 PDT 2019


owenpan added a comment.

The patch would have no effect if the `using` statement is not in a block, but that would probably be against C# syntax.

Please see my comments about the test cases. Otherwise, LGTM.



================
Comment at: clang/unittests/Format/FormatTestCSharp.cpp:168
 
+TEST_F(FormatTestCSharp, CSharpUsing) {
+  FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp);
----------------
I'd add the following as the first test case because it tests the new behavior. The other two test cases only verify that the patch does not cause regressions. (The `SBPO_Always` case may be redundant if it's already covered in `FormatTest.cpp`.)
```
  // SpaceBeforeParens: ControlStatements
  verifyFormat("public void foo() {\n"
               "  using (StreamWriter sw = new StreamWriter(filenameA)) {}\n"
               "}");
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66662/new/

https://reviews.llvm.org/D66662





More information about the llvm-commits mailing list