Skip to content

Commit aef60e6

Browse files
committed
[sil] Add an overload to SILDebugScope::dump that just takes a SILModule as an argument.
We do not in general want SIL code to root around in the ASTContext. Better to just have a helper that knows how to fish it out.
1 parent 967313a commit aef60e6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

include/swift/SIL/SILDebugScope.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ class SILDebugScope : public SILAllocated<SILDebugScope> {
6565
SILFunction *getParentFunction() const;
6666

6767
#ifndef NDEBUG
68-
void dump(SourceManager &SM, llvm::raw_ostream &OS = llvm::errs(),
69-
unsigned Indent = 0) const;
68+
LLVM_ATTRIBUTE_DEPRECATED(void dump(SourceManager &SM, llvm::raw_ostream &OS = llvm::errs(),
69+
unsigned Indent = 0) const,
70+
"only for use in the debugger");
71+
LLVM_ATTRIBUTE_DEPRECATED(void dump(SILModule &Mod) const, "only for use in the debugger");
7072
#endif
7173
};
7274

lib/SIL/SILPrinter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3005,6 +3005,12 @@ void SILDebugScope::dump(SourceManager &SM, llvm::raw_ostream &OS,
30053005
}
30063006
OS << "}\n";
30073007
}
3008+
3009+
void SILDebugScope::dump(SILModule &Mod) const {
3010+
// We just use the default indent and llvm::errs().
3011+
dump(Mod.getASTContext().SourceMgr);
3012+
}
3013+
30083014
#endif
30093015

30103016
void SILSpecializeAttr::print(llvm::raw_ostream &OS) const {

0 commit comments

Comments
 (0)