[llvm] Strip the full path from __FILE__ in the LDBG macro and keep only the filename (PR #150677)
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 25 11:54:40 PDT 2025
================
@@ -29,7 +29,15 @@ namespace llvm {
#define DEBUGLOG_WITH_STREAM_AND_TYPE(STREAM, TYPE) \
for (bool _c = (::llvm::DebugFlag && ::llvm::isCurrentDebugType(TYPE)); _c; \
_c = false) \
- ::llvm::impl::LogWithNewline(TYPE, __FILE__, __LINE__, (STREAM))
+ ::llvm::impl::LogWithNewline( \
+ TYPE, \
+ [] { \
----------------
joker-eph wrote:
I don't think it can be constexpr evaluated in this case?
```
include/llvm/Support/DebugLog.h:48:27: error: constexpr variable 'filename' must be initialized by a constant expression
48 | constexpr const char *filename =
| ^
49 | ::llvm::impl::LogWithNewline::getFileName(file);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/llvm/Support/DebugLog.h:49:49: note: function parameter 'file' with unknown value cannot be used in a constant expression
49 | ::llvm::impl::LogWithNewline::getFileName(file);
| ^
include/llvm/Support/DebugLog.h:45:64: note: declared here
45 | constexpr LogWithNewline(const char *debug_type, const char *file, int line,
| ^
1 error generated.
```
```
https://github.com/llvm/llvm-project/pull/150677
More information about the llvm-commits
mailing list