[llvm] a2fcf18 - Fix `DEBUGLOG_WITH_STREAM_TYPE_AND_FILE` broken in #150750 (#150920)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 28 04:25:12 PDT 2025
Author: Ingo Müller
Date: 2025-07-28T13:25:09+02:00
New Revision: a2fcf18d71b3c3d4e7b52e558124eae8ae7c4a83
URL: https://github.com/llvm/llvm-project/commit/a2fcf18d71b3c3d4e7b52e558124eae8ae7c4a83
DIFF: https://github.com/llvm/llvm-project/commit/a2fcf18d71b3c3d4e7b52e558124eae8ae7c4a83.diff
LOG: Fix `DEBUGLOG_WITH_STREAM_TYPE_AND_FILE` broken in #150750 (#150920)
This PR fixes the `DEBUGLOG_WITH_STREAM_TYPE_AND_FILE` macro that got
broken in #150750. That PR introduces a more sophisitaced version of
that macro and refactored some code in that process, making the
`getShortFileName` a free function instead of a class member function,
but did not adapt this macro to the refactored code.
Signed-off-by: Ingo Müller <ingomueller at google.com>
Added:
Modified:
llvm/include/llvm/Support/DebugLog.h
llvm/unittests/Support/DebugLogTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/DebugLog.h b/llvm/include/llvm/Support/DebugLog.h
index 19d309865bbd4..5e308eb993036 100644
--- a/llvm/include/llvm/Support/DebugLog.h
+++ b/llvm/include/llvm/Support/DebugLog.h
@@ -40,8 +40,8 @@ namespace llvm {
DEBUGLOG_WITH_STREAM_TYPE_AND_FILE(STREAM, TYPE, __SHORT_FILE__)
#else
#define DEBUGLOG_WITH_STREAM_AND_TYPE(STREAM, TYPE) \
- DEBUGLOG_WITH_STREAM_TYPE_AND_FILE( \
- STREAM, TYPE, ::llvm::impl::LogWithNewline::getShortFileName(__FILE__))
+ DEBUGLOG_WITH_STREAM_TYPE_AND_FILE(STREAM, TYPE, \
+ ::llvm::impl::getShortFileName(__FILE__))
#endif
namespace impl {
diff --git a/llvm/unittests/Support/DebugLogTest.cpp b/llvm/unittests/Support/DebugLogTest.cpp
index c34d888ab4cad..3217f63745c90 100644
--- a/llvm/unittests/Support/DebugLogTest.cpp
+++ b/llvm/unittests/Support/DebugLogTest.cpp
@@ -6,6 +6,11 @@
//
//===----------------------------------------------------------------------===//
+// This macro is defined in the LLVM build system, but we undefine it here
+// so that we test at least once in-tree the case where __SHORT_FILE__ is not
+// defined.
+#undef __SHORT_FILE__
+
#include "llvm/Support/DebugLog.h"
#include "llvm/Support/raw_ostream.h"
#include "gmock/gmock.h"
More information about the llvm-commits
mailing list