exv updated this revision to Diff 342497. exv added a comment. Remove special whitespace handling for ??=
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D101702/new/ https://reviews.llvm.org/D101702 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 @@ -359,8 +359,16 @@ } TEST_F(FormatTestCSharp, CSharpNullCoalescingAssignment) { - verifyFormat("test \?\?= ABC;"); - verifyFormat("test \?\?= true;"); + FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); + Style.SpaceBeforeAssignmentOperators = true; + + verifyFormat("test \?\?= ABC;", Style); + verifyFormat("test \?\?= true;", Style); + + Style.SpaceBeforeAssignmentOperators = false; + + verifyFormat("test\?\?= ABC;", Style); + verifyFormat("test\?\?= true;", Style); } TEST_F(FormatTestCSharp, CSharpNullForgiving) { Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -3191,11 +3191,6 @@ if (Left.is(TT_CSharpNullCoalescing) || Right.is(TT_CSharpNullCoalescing)) return true; - // Space before and after '??='. - if (Left.is(TT_CSharpNullCoalescingAssignment) || - Right.is(TT_CSharpNullCoalescingAssignment)) - return true; - // No space before null forgiving '!'. if (Right.is(TT_JsNonNullAssertion)) return false;
Index: clang/unittests/Format/FormatTestCSharp.cpp =================================================================== --- clang/unittests/Format/FormatTestCSharp.cpp +++ clang/unittests/Format/FormatTestCSharp.cpp @@ -359,8 +359,16 @@ } TEST_F(FormatTestCSharp, CSharpNullCoalescingAssignment) { - verifyFormat("test \?\?= ABC;"); - verifyFormat("test \?\?= true;"); + FormatStyle Style = getGoogleStyle(FormatStyle::LK_CSharp); + Style.SpaceBeforeAssignmentOperators = true; + + verifyFormat("test \?\?= ABC;", Style); + verifyFormat("test \?\?= true;", Style); + + Style.SpaceBeforeAssignmentOperators = false; + + verifyFormat("test\?\?= ABC;", Style); + verifyFormat("test\?\?= true;", Style); } TEST_F(FormatTestCSharp, CSharpNullForgiving) { Index: clang/lib/Format/TokenAnnotator.cpp =================================================================== --- clang/lib/Format/TokenAnnotator.cpp +++ clang/lib/Format/TokenAnnotator.cpp @@ -3191,11 +3191,6 @@ if (Left.is(TT_CSharpNullCoalescing) || Right.is(TT_CSharpNullCoalescing)) return true; - // Space before and after '??='. - if (Left.is(TT_CSharpNullCoalescingAssignment) || - Right.is(TT_CSharpNullCoalescingAssignment)) - return true; - // No space before null forgiving '!'. if (Right.is(TT_JsNonNullAssertion)) return false;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits