[PATCH] D127685: [clang-format] Never analyze insert/remove braces in the same pass

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 14 22:43:46 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG07b3446d7243: [clang-format] Never analyze insert/remove braces in the same pass (authored by owenpan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127685

Files:
  clang/lib/Format/Format.cpp


Index: clang/lib/Format/Format.cpp
===================================================================
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -1833,7 +1833,9 @@
 class BracesInserter : public TokenAnalyzer {
 public:
   BracesInserter(const Environment &Env, const FormatStyle &Style)
-      : TokenAnalyzer(Env, Style) {}
+      : TokenAnalyzer(Env, Style) {
+    this->Style.RemoveBracesLLVM = false;
+  }
 
   std::pair<tooling::Replacements, unsigned>
   analyze(TokenAnnotator &Annotator,
@@ -1875,7 +1877,9 @@
 class BracesRemover : public TokenAnalyzer {
 public:
   BracesRemover(const Environment &Env, const FormatStyle &Style)
-      : TokenAnalyzer(Env, Style) {}
+      : TokenAnalyzer(Env, Style) {
+    this->Style.InsertBraces = false;
+  }
 
   std::pair<tooling::Replacements, unsigned>
   analyze(TokenAnnotator &Annotator,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127685.437036.patch
Type: text/x-patch
Size: 871 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220615/dc996502/attachment.bin>


More information about the cfe-commits mailing list