Skip to content

Commit a670a34

Browse files
committed
[sil] Add SILValue::dump() for use in the debugger.
It just trampolines to calling ValueBase::dump(). The reason I added this is sometimes one wants to do this in the debugger and confuses if one has a ValueBase or a SILValue causing lldb to be unhappy. By mirroring this API, one can do the same operation on either type and just move on with ones life. I also wrapped this in LLVM_ATTRIBUTE_DEPRECATED with a msg saying only for use in the debugger so people do not call dump() in the codebase by mistake.
1 parent de0aaec commit a670a34

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

include/swift/SIL/SILValue.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "llvm/ADT/Hashing.h"
2929
#include "llvm/ADT/Optional.h"
3030
#include "llvm/ADT/PointerUnion.h"
31+
#include "llvm/Support/Compiler.h"
3132
#include "llvm/Support/raw_ostream.h"
3233

3334
namespace swift {
@@ -642,6 +643,9 @@ class SILValue {
642643

643644
/// Verify that this SILValue and its uses respects ownership invariants.
644645
void verifyOwnership(DeadEndBlocks *DEBlocks) const;
646+
647+
LLVM_ATTRIBUTE_DEPRECATED(void dump() const LLVM_ATTRIBUTE_USED,
648+
"Only for use in the debugger");
645649
};
646650

647651
inline SILNodePointer::SILNodePointer(SILValue value) : node(value) { }

lib/SIL/IR/SILValue.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ SILLocation SILValue::getLoc() const {
134134
return Value->getFunction()->getLocation();
135135
}
136136

137+
void SILValue::dump() const {
138+
Value->dump();
139+
}
140+
137141
//===----------------------------------------------------------------------===//
138142
// OwnershipKind
139143
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)