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

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 5 07:28:03 PST 2025


jhuber6 wrote:

> Have you considered model this after https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Support/DebugLog.h? That is,
> 
> ```c++
> 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](#user-content-fn-1-0c3704e3ba10abed1be797a3542229c7) in non-assert builds, so it will be optimized away.
> ## Footnotes
> 
>     1. Actually `for (bool _c = false; _c; _c = false) ::llvm::nulls()` to avoid compiler warnings. [↩](#user-content-fnref-1-0c3704e3ba10abed1be797a3542229c7)

That'd probably work well, we could make it like `LDBG(Tags, ...)`.

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


More information about the llvm-commits mailing list