[clang] 0be56c8 - [clang-format][NFC] Group all C++ passes under isCpp()
via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 10 14:30:38 PST 2022
Author: owenca
Date: 2022-03-10T14:30:30-08:00
New Revision: 0be56c87013b585405209f324cc8dfc5ebde416f
URL: https://github.com/llvm/llvm-project/commit/0be56c87013b585405209f324cc8dfc5ebde416f
DIFF: https://github.com/llvm/llvm-project/commit/0be56c87013b585405209f324cc8dfc5ebde416f.diff
LOG: [clang-format][NFC] Group all C++ passes under isCpp()
Also removes a not very helpful comment.
Added:
Modified:
clang/lib/Format/Format.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index a8b8efb5b22f5..9e3eaf72e121e 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1800,7 +1800,6 @@ class BracesRemover : public TokenAnalyzer {
}
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();
More information about the cfe-commits
mailing list