[PATCH] D122468: [clang-format] Fix SeparateDefinitionBlocks breaking up function-try-block.

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 27 16:34:20 PDT 2022


owenpan added a comment.

We can refactor by extending `_verifyFormat()` instead of adding a new function.



================
Comment at: clang/unittests/Format/DefinitionBlockSeparatorTest.cpp:46
                             const FormatStyle &Style = getLLVMStyle(),
                             llvm::StringRef ExpectedCode = "") {
     ::testing::ScopedTrace t(File, Line, ::testing::Message() << Code.str());
----------------



================
Comment at: clang/unittests/Format/DefinitionBlockSeparatorTest.cpp:54
 
     FormatStyle InverseStyle = Style;
     if (Style.SeparateDefinitionBlocks == FormatStyle::SDS_Always)
----------------



================
Comment at: clang/unittests/Format/DefinitionBlockSeparatorTest.cpp:64
         << "Inverse formatting makes no difference";
     std::string CodeToFormat =
         HasOriginalCode ? Code.str() : removeEmptyLines(Code);
----------------



================
Comment at: clang/unittests/Format/DefinitionBlockSeparatorTest.cpp:476
+  Style.SeparateDefinitionBlocks = FormatStyle::SDS_Always;
+  verifyFormatNoInverse("void FunctionWithInternalTry()\n"
+                        "{\n"
----------------



================
Comment at: clang/unittests/Format/DefinitionBlockSeparatorTest.cpp:486
+                        "}",
+                        Style);
+  verifyFormatNoInverse("void FunctionWithTryBlock()\n"
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122468



More information about the cfe-commits mailing list