[clang-format][NFC] Group all C++ passes under isCpp()
authorowenca <owenpiano@gmail.com>
Thu, 10 Mar 2022 22:20:24 +0000 (14:20 -0800)
committerowenca <owenpiano@gmail.com>
Thu, 10 Mar 2022 22:30:30 +0000 (14:30 -0800)
Also removes a not very helpful comment.

clang/lib/Format/Format.cpp

index a8b8efb..9e3eaf7 100644 (file)
@@ -1800,7 +1800,6 @@ public:
   }
 
 private:
-  // Remove optional braces.
   void removeBraces(SmallVectorImpl<AnnotatedLine *> &Lines,
                     tooling::Replacements &Result) {
     const auto &SourceMgr = Env.getSourceManager();
@@ -3181,17 +3180,17 @@ reformat(const FormatStyle &Style, StringRef Code,
     });
   }
 
-  if (Style.isCpp() && Style.InsertBraces)
-    Passes.emplace_back([&](const Environment &Env) {
-      return BracesInserter(Env, Expanded).process();
-    });
+  if (Style.isCpp()) {
+    if (Style.InsertBraces)
+      Passes.emplace_back([&](const Environment &Env) {
+        return BracesInserter(Env, Expanded).process();
+      });
 
-  if (Style.isCpp() && Style.RemoveBracesLLVM)
-    Passes.emplace_back([&](const Environment &Env) {
-      return BracesRemover(Env, Expanded).process();
-    });
+    if (Style.RemoveBracesLLVM)
+      Passes.emplace_back([&](const Environment &Env) {
+        return BracesRemover(Env, Expanded).process();
+      });
 
-  if (Style.isCpp()) {
     if (Style.FixNamespaceComments)
       Passes.emplace_back([&](const Environment &Env) {
         return NamespaceEndCommentsFixer(Env, Expanded).process();