summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorowenca <owenpiano@gmail.com>2022-03-10 14:20:24 -0800
committerowenca <owenpiano@gmail.com>2022-03-10 14:30:30 -0800
commit0be56c87013b585405209f324cc8dfc5ebde416f (patch)
tree96376190270bec7a0c58af3bf653ab0a7595847c
parent2d58ba200a39ddacaa9923cb623321c295ae5949 (diff)
[clang-format][NFC] Group all C++ passes under isCpp()
Also removes a not very helpful comment.
-rw-r--r--clang/lib/Format/Format.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index a8b8efb5b22f..9e3eaf72e121 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<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();