owenpan created this revision. owenpan added reviewers: curdeius, HazardyKnusperkeks, MyDeveloperDay. owenpan added a project: clang-format. Herald added a project: All. owenpan requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Turn off `RemoveBracesLLVM` while analyzing `InsertBraces` and vice versa to avoid potential interference of each other and better the performance. Repository: rG LLVM Github Monorepo 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,
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,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits