Skip to content

Commit a2fcf18

Browse files
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 <[email protected]>
1 parent d803c61 commit a2fcf18

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

llvm/include/llvm/Support/DebugLog.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ namespace llvm {
4040
DEBUGLOG_WITH_STREAM_TYPE_AND_FILE(STREAM, TYPE, __SHORT_FILE__)
4141
#else
4242
#define DEBUGLOG_WITH_STREAM_AND_TYPE(STREAM, TYPE) \
43-
DEBUGLOG_WITH_STREAM_TYPE_AND_FILE( \
44-
STREAM, TYPE, ::llvm::impl::LogWithNewline::getShortFileName(__FILE__))
43+
DEBUGLOG_WITH_STREAM_TYPE_AND_FILE(STREAM, TYPE, \
44+
::llvm::impl::getShortFileName(__FILE__))
4545
#endif
4646

4747
namespace impl {

llvm/unittests/Support/DebugLogTest.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
// This macro is defined in the LLVM build system, but we undefine it here
10+
// so that we test at least once in-tree the case where __SHORT_FILE__ is not
11+
// defined.
12+
#undef __SHORT_FILE__
13+
914
#include "llvm/Support/DebugLog.h"
1015
#include "llvm/Support/raw_ostream.h"
1116
#include "gmock/gmock.h"

0 commit comments

Comments
 (0)