[llvm] [OptBisect] Add support for selecting ranges of passes and refactor DebugCounter to use a shared Range API. (PR #152393)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 5 08:03:26 PDT 2025
================
@@ -0,0 +1,153 @@
+//===- llvm/Support/Range.cpp - Range parsing utility ---------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/Range.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/Regex.h"
+#include "llvm/Support/raw_ostream.h"
+#include <sstream>
+
+using namespace llvm;
+
+Expected<RangeUtils::RangeList> RangeUtils::parseRanges(const StringRef Str,
+ const char Separator) {
+ RangeList Ranges;
+
+ if (Str.empty())
+ return std::move(Ranges);
+
+ // Split by the specified separator
+ SmallVector<StringRef, 8> Parts;
+ Str.split(Parts, Separator, -1, false);
----------------
nikic wrote:
There is an iterator variant of this, no need to collect into a vector.
https://github.com/llvm/llvm-project/pull/152393
More information about the llvm-commits
mailing list