[PATCH] D128574: [clang-format] Quit analyzing solution space for large state count

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 26 13:15:48 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG664ce34e81d9: [clang-format] Quit analyzing solution space for large state count (authored by owenpan).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128574/new/

https://reviews.llvm.org/D128574

Files:
  clang/lib/Format/UnwrappedLineFormatter.cpp


Index: clang/lib/Format/UnwrappedLineFormatter.cpp
===================================================================
--- clang/lib/Format/UnwrappedLineFormatter.cpp
+++ clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -1163,6 +1163,10 @@
 
     // 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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128574.440087.patch
Type: text/x-patch
Size: 566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220626/c9d67ac8/attachment.bin>


More information about the cfe-commits mailing list