HazardyKnusperkeks created this revision. HazardyKnusperkeks added reviewers: MyDeveloperDay, curdeius, owenpan. HazardyKnusperkeks added a project: clang-format. HazardyKnusperkeks requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Let only the JS/TS users pay for the initialistation. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D115068 Files: clang/lib/Format/ContinuationIndenter.cpp Index: clang/lib/Format/ContinuationIndenter.cpp =================================================================== --- clang/lib/Format/ContinuationIndenter.cpp +++ clang/lib/Format/ContinuationIndenter.cpp @@ -493,14 +493,14 @@ 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.
Index: clang/lib/Format/ContinuationIndenter.cpp =================================================================== --- clang/lib/Format/ContinuationIndenter.cpp +++ clang/lib/Format/ContinuationIndenter.cpp @@ -493,14 +493,14 @@ 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