From: owenca Date: Thu, 10 Mar 2022 22:20:24 +0000 (-0800) Subject: [clang-format][NFC] Group all C++ passes under isCpp() X-Git-Tag: upstream/15.0.7~13978 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0be56c87013b585405209f324cc8dfc5ebde416f;p=platform%2Fupstream%2Fllvm.git [clang-format][NFC] Group all C++ passes under isCpp() Also removes a not very helpful comment. --- diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index a8b8efb..9e3eaf7 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1800,7 +1800,6 @@ public: } private: - // Remove optional braces. void removeBraces(SmallVectorImpl &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();