Author: owenca Date: 2022-06-26T13:15:07-07:00 New Revision: 664ce34e81d98af7859754f127b28030b45c8893
URL: https://github.com/llvm/llvm-project/commit/664ce34e81d98af7859754f127b28030b45c8893 DIFF: https://github.com/llvm/llvm-project/commit/664ce34e81d98af7859754f127b28030b45c8893.diff LOG: [clang-format] Quit analyzing solution space for large state count Fixes #56043. Differential Revision: https://reviews.llvm.org/D128574 Added: Modified: clang/lib/Format/UnwrappedLineFormatter.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp index b8a535b8d527f..22509a5042465 100644 --- a/clang/lib/Format/UnwrappedLineFormatter.cpp +++ b/clang/lib/Format/UnwrappedLineFormatter.cpp @@ -1163,6 +1163,10 @@ class OptimizingLineFormatter : public LineFormatter { // While not empty, take first element and follow edges. while (!Queue.empty()) { + // Quit if we still haven't found a solution by now. + if (Count > 25000000) + return 0; + Penalty = Queue.top().first.first; StateNode *Node = Queue.top().second; if (!Node->State.NextToken) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits