[PATCH] D151047: [clang-format] Fix indent for selective formatting.

Owen Pan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 17:39:15 PDT 2023


owenpan added inline comments.


================
Comment at: clang/unittests/Format/FormatTestSelective.cpp:641-646
+  Style = getLLVMStyle();
+  Style.FixNamespaceComments = false;
+  Code = "namespace ns {\n"
+         "#define REF(alias) alias alias_var;\n"
+         "}";
+  EXPECT_EQ(Code, format(Code, 51, 1));
----------------
I suppose this would make the purpose of the test more clear. However, this new test (in either version) would pass without the patch, so it doesn't capture the bug mentioned in D151047#4369742?


================
Comment at: clang/unittests/Format/FormatTestSelective.cpp:649
+
+TEST_F(FormatTestSelective, FormatMacroRegardlessOfPreviousIndent) {
+  // clang-format currently does not (or should not) take into account the
----------------
Again, these tests would pass without the patch.


================
Comment at: clang/unittests/Format/FormatTestSelective.cpp:658
+
+  Style.IndentPPDirectives = FormatStyle::PPDirectiveIndentStyle::PPDIS_None;
+  EXPECT_EQ("      class Foo {\n"
----------------
It's the default and can be deleted.


================
Comment at: clang/unittests/Format/FormatTestSelective.cpp:664
+            "#endif\n"       // That this line is also formatted might be a bug.
+            "            }};", // Dito: Bug?
+            format("      class Foo {\n"
----------------
Typo.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151047



More information about the llvm-commits mailing list