[llvm] [OFFLOAD] Add support for more fine grained debug messages control (PR #165416)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 5 07:26:26 PST 2025


Meinersbur wrote:

Have you considered model this after https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Support/DebugLog.h? That is,

```cpp
LDBG() << "message";
```
instead of 
```
LLVM_DEBUG(llvm::dbgs << "message");
```

Besides being shorter, advantages include is that it works better with code-completion than in a macro argument, and you do not get "unused variable" warnings in non-assert builds. LDBG() expands to `if (0) llvm::nulls()`[^1] in non-assert builds, so it will be optimized away.

[^1]: Actually `for (bool _c = false; _c; _c = false) ::llvm::nulls()` to avoid compiler warnings.

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


More information about the llvm-commits mailing list