[llvm] Introduce LDBG_OS() macro as a variant of LDBG() (PR #157194)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 9 08:54:05 PDT 2025


================
@@ -173,17 +344,17 @@ getShortFileName(const char *path) {
 /// "[DebugType] File:Line "
 /// Where the File is the file name without the path prefix.
 static LLVM_ATTRIBUTE_UNUSED std::string
-computePrefix(const char *DebugType, const char *File, int Line, int Level) {
+computePrefix(StringRef DebugType, const char *File, int Line, int Level) {
----------------
joker-eph wrote:

It's needed because of the auto-detection for DEBUG_TYPE mean that we get a literal that is:

`"\"my-debug-type\""` and we use a StringRef in `operator""_LDBG_DEBUG_STRING` to remove the extra surrounding double quotes.
If someone knows a better macro expansion, I'm interested, but it took me 2h to come up with these tricks :)

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


More information about the llvm-commits mailing list