@@ -26,25 +26,27 @@ namespace llvm {
26
26
// << "] " << "Bitset contains: " << Bitset << "\n");
27
27
#define LDBG () DEBUGLOG_WITH_STREAM_AND_TYPE(llvm::dbgs(), DEBUG_TYPE)
28
28
29
+ #if defined(__SHORT_FILE__)
29
30
#define DEBUGLOG_WITH_STREAM_AND_TYPE (STREAM, TYPE ) \
30
31
for (bool _c = (::llvm::DebugFlag && ::llvm::isCurrentDebugType(TYPE)); _c; \
31
32
_c = false ) \
32
- ::llvm::impl::LogWithNewline ( \
33
- TYPE, \
34
- [] { \
35
- /* Force constexpr eval */ \
36
- constexpr const char *filename = \
37
- ::llvm::impl::LogWithNewline::getFileName (__FILE__); \
38
- return filename; \
39
- }(), \
40
- __LINE__, (STREAM))
33
+ ::llvm::impl::LogWithNewline (TYPE, __SHORT_FILE__, __LINE__, (STREAM))
34
+ #else
35
+ #define DEBUGLOG_WITH_STREAM_AND_TYPE (STREAM, TYPE ) \
36
+ for (bool _c = (::llvm::DebugFlag && ::llvm::isCurrentDebugType(TYPE)); _c; \
37
+ _c = false ) \
38
+ ::llvm::impl::LogWithNewline (TYPE, __FILE__, __LINE__, (STREAM))
39
+ #endif
41
40
42
41
namespace impl {
43
42
class LogWithNewline {
44
43
public:
45
44
LogWithNewline (const char *debug_type, const char *file, int line,
46
45
raw_ostream &os)
47
46
: os(os) {
47
+ #if !defined(__SHORT_FILE__)
48
+ file = ::llvm::impl::LogWithNewline::getShortFileName (file);
49
+ #endif
48
50
if (debug_type)
49
51
os << " [" << debug_type << " ] " ;
50
52
os << file << " :" << line << " " ;
@@ -59,7 +61,7 @@ class LogWithNewline {
59
61
LogWithNewline (const LogWithNewline &) = delete ;
60
62
LogWithNewline &operator =(const LogWithNewline &) = delete ;
61
63
LogWithNewline &operator =(LogWithNewline &&) = delete ;
62
- static constexpr const char *getFileName (const char *path) {
64
+ static constexpr const char *getShortFileName (const char *path) {
63
65
// Remove the path prefix from the file name.
64
66
const char *filename = path;
65
67
for (const char *p = path; *p != ' \0 ' ; ++p) {
0 commit comments