Skip to content

Commit 5f2aa25

Browse files
committed
[mangler] Add support for dumping the current buffer string. Just for the debugger.
1 parent 5a42260 commit 5f2aa25

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

include/swift/Basic/Mangler.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "llvm/ADT/SmallString.h"
2222
#include "llvm/ADT/StringRef.h"
2323
#include "llvm/ADT/StringMap.h"
24+
#include "llvm/Support/Debug.h"
2425
#include "llvm/Support/raw_ostream.h"
2526

2627
namespace swift {
@@ -100,14 +101,24 @@ class Mangler {
100101
return StringRef(Storage.data(), Storage.size());
101102
}
102103

104+
void print(llvm::raw_ostream &os) const {
105+
os << getBufferStr() << '\n';
106+
}
107+
108+
public:
109+
/// Dump the current stored state in the Mangler. Only for use in the debugger!
110+
SWIFT_DEBUG_DUMPER(dumpBufferStr()) {
111+
print(llvm::dbgs());
112+
}
113+
114+
protected:
103115
/// Removes the last characters of the buffer by setting it's size to a
104116
/// smaller value.
105117
void resetBuffer(size_t toPos) {
106118
assert(toPos <= Storage.size());
107119
Storage.resize(toPos);
108120
}
109121

110-
protected:
111122
Mangler() : Buffer(Storage) { }
112123

113124
/// Begins a new mangling but does not add the mangling prefix.

0 commit comments

Comments
 (0)