[llvm] [DebugCounter] Add support for non-continous ranges. (PR #89470)

Nicolai Hähnle via llvm-commits llvm-commits at lists.llvm.org
Thu May 16 12:47:32 PDT 2024


================
@@ -0,0 +1,151 @@
+//===-- delta-driver.cpp - Tool to drive Automated Delta Debugging --------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// See the llvm-project/llvm/docs/ProgrammersManual.rst to see how to use this
+// tool
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/DenseSet.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/DebugCounter.h"
+#include "llvm/Support/Program.h"
+
+using namespace llvm;
+
+cl::opt<std::string> ReproductionCmd(cl::Positional, cl::Required);
+
+cl::opt<std::string> StartChunks(cl::Positional, cl::Required);
+
+cl::opt<bool> Pessimist("pessimist", cl::init(false));
+
+SmallVector<Chunk> simplifyChunksList(const SmallVector<Chunk> &Chunks) {
+  SmallVector<Chunk> Res;
+  Res.push_back(Chunks.front());
+  for (unsigned Idx = 1; Idx < Chunks.size(); Idx++) {
+    if (Chunks[Idx].Begin == Res.back().End + 1)
+      Res.back().End = Chunks[Idx].End;
+    else
+      Res.push_back(Chunks[Idx]);
+  }
+  return Res;
+}
+
+bool stillReproducesIssue(const SmallVector<Chunk> &Chunks) {
----------------
nhaehnle wrote:

Since you're using the "interesting" terminology elsewhere (which is good!), just rename this to `isInteresting`.

Also, it would be slightly more idiomatic to have the argument be `ArrayRef<Chunk> Chunks`.

https://github.com/llvm/llvm-project/pull/89470


More information about the llvm-commits mailing list