[Mlir-commits] [llvm] [mlir] Introduce a "log level" support for DEBUG_TYPE (PR #150855)
Mehdi Amini
llvmlistbot at llvm.org
Mon Jul 28 04:55:43 PDT 2025
================
@@ -38,25 +40,52 @@
using namespace llvm;
+/// Parse a debug type string into a pair of the debug type and the debug level.
+/// The expected format is "type[:level]", where the level is an optional
+/// integer.
+static std::pair<std::string, int> parseDebugType(StringRef DbgType) {
+ int Level = 0;
+ size_t ColonPos = DbgType.find(':');
+ if (ColonPos != StringRef::npos) {
+ StringRef LevelStr = DbgType.substr(ColonPos + 1);
+ DbgType = DbgType.take_front(ColonPos);
+ if (LevelStr.empty())
+ Level = -1;
----------------
joker-eph wrote:
This is providing a "negative filter": that is instead of opting out for specific DEBUG_TYPE you can opt out.
For example running with:
```
--debug-only=pattern-application:-1
```
Will print everything **but** the `pattern-application` type.
https://github.com/llvm/llvm-project/pull/150855
More information about the Mlir-commits
mailing list