[clang] [clang-format] Change SpaceAfterLogicalNot to enumeration type (PR #150166)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 23 20:52:12 PDT 2025


================
@@ -17762,14 +17762,19 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) {
 }
 
 TEST_F(FormatTest, SpaceAfterLogicalNot) {
-  FormatStyle Spaces = getLLVMStyle();
-  Spaces.SpaceAfterLogicalNot = true;
+  auto Spaces = getLLVMStyle();
+  EXPECT_EQ(Spaces.SpaceAfterLogicalNot, FormatStyle::SAN_Never);
 
+  Spaces.SpaceAfterLogicalNot = FormatStyle::SAN_Exclaim;
   verifyFormat("bool x = ! y", Spaces);
   verifyFormat("if (! isFailure())", Spaces);
   verifyFormat("if (! (a && b))", Spaces);
   verifyFormat("\"Error!\"", Spaces);
   verifyFormat("! ! x", Spaces);
----------------
owenca wrote:

`SAN_Exclaim` deprecates `true` and has no effect on `not`, which should be already covered by test cases elsewhere.

https://github.com/llvm/llvm-project/pull/150166


More information about the cfe-commits mailing list