[PATCH] D76621: [clang-format] No space inserted between commas in C#
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 23 10:23:16 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG04336ada1756: [clang-format] No space inserted between commas in C# (authored by Jonathan Coe <jbcoe at google.com>).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76621/new/
https://reviews.llvm.org/D76621
Files:
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTestCSharp.cpp
Index: clang/unittests/Format/FormatTestCSharp.cpp
===================================================================
--- clang/unittests/Format/FormatTestCSharp.cpp
+++ clang/unittests/Format/FormatTestCSharp.cpp
@@ -640,9 +640,12 @@
verifyFormat(R"(private float[,] Values;)", Style);
verifyFormat(R"(Result this[Index x] => Foo(x);)", Style);
+ verifyFormat(R"(char[,,] rawCharArray = MakeCharacterGrid();)", Style);
+
Style.SpacesInSquareBrackets = true;
verifyFormat(R"(private float[ , ] Values;)", Style);
verifyFormat(R"(string dirPath = args?[ 0 ];)", Style);
+ verifyFormat(R"(char[ ,, ] rawCharArray = MakeCharacterGrid();)", Style);
}
TEST_F(FormatTestCSharp, CSharpNullableTypes) {
Index: clang/lib/Format/TokenAnnotator.cpp
===================================================================
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -3015,6 +3015,10 @@
if (Right.is(TT_CSharpNullConditionalLSquare))
return false;
+ // No space between consecutive commas '[,,]'.
+ if (Left.is(tok::comma) && Right.is(tok::comma))
+ return false;
+
// Possible space inside `?[ 0 ]`.
if (Left.is(TT_CSharpNullConditionalLSquare))
return Style.SpacesInSquareBrackets;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76621.252091.patch
Type: text/x-patch
Size: 1272 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200323/9d4cf6b4/attachment.bin>
More information about the cfe-commits
mailing list