Author: Björn Schäpers Date: 2021-12-04T21:29:30+01:00 New Revision: 8d1c85454daa40bd663d0ef4e8262fe6fc0f21ad
URL: https://github.com/llvm/llvm-project/commit/8d1c85454daa40bd663d0ef4e8262fe6fc0f21ad DIFF: https://github.com/llvm/llvm-project/commit/8d1c85454daa40bd663d0ef4e8262fe6fc0f21ad.diff LOG: [clang-format][NFC] Move static variable in scope Let only the JS/TS users pay for the initialistation. Differential Revision: https://reviews.llvm.org/D115068 Added: Modified: clang/lib/Format/ContinuationIndenter.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 5073f5105d05..cbb8d5093ca0 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -493,14 +493,14 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { return true; } - // Break after the closing parenthesis of TypeScript decorators before - // functions, getters and setters. - static const llvm::StringSet<> BreakBeforeDecoratedTokens = {"get", "set", - "function"}; if (Style.Language == FormatStyle::LK_JavaScript && - BreakBeforeDecoratedTokens.contains(Current.TokenText) && Previous.is(tok::r_paren) && Previous.is(TT_JavaAnnotation)) { - return true; + // Break after the closing parenthesis of TypeScript decorators before + // functions, getters and setters. + static const llvm::StringSet<> BreakBeforeDecoratedTokens = {"get", "set", + "function"}; + if (BreakBeforeDecoratedTokens.contains(Current.TokenText)) + return true; } // If the return type spans multiple lines, wrap before the function name. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits