|
14 | 14 | //
|
15 | 15 | //===----------------------------------------------------------------------===//
|
16 | 16 |
|
17 |
| -#include "swift/Basic/QuotedString.h" |
18 | 17 | #include "swift/AST/ASTContext.h"
|
19 | 18 | #include "swift/AST/ASTPrinter.h"
|
20 | 19 | #include "swift/AST/ASTVisitor.h"
|
|
24 | 23 | #include "swift/AST/ParameterList.h"
|
25 | 24 | #include "swift/AST/ProtocolConformance.h"
|
26 | 25 | #include "swift/AST/TypeVisitor.h"
|
| 26 | +#include "swift/Basic/QuotedString.h" |
27 | 27 | #include "swift/Basic/STLExtras.h"
|
28 | 28 | #include "llvm/ADT/APFloat.h"
|
29 | 29 | #include "llvm/ADT/Optional.h"
|
30 | 30 | #include "llvm/ADT/SmallString.h"
|
31 | 31 | #include "llvm/ADT/StringExtras.h"
|
32 | 32 | #include "llvm/Support/ErrorHandling.h"
|
| 33 | +#include "llvm/Support/FileSystem.h" |
33 | 34 | #include "llvm/Support/Process.h"
|
34 | 35 | #include "llvm/Support/SaveAndRestore.h"
|
35 | 36 | #include "llvm/Support/raw_ostream.h"
|
@@ -1177,6 +1178,16 @@ void Decl::dump() const {
|
1177 | 1178 | dump(llvm::errs(), 0);
|
1178 | 1179 | }
|
1179 | 1180 |
|
| 1181 | +void Decl::dump(const char *filename) const { |
| 1182 | + std::error_code ec; |
| 1183 | + llvm::raw_fd_ostream stream(filename, ec, llvm::sys::fs::F_RW); |
| 1184 | + // In assert builds, we blow up. Otherwise, we just return. |
| 1185 | + assert(!ec && "Failed to open file for dumping?!"); |
| 1186 | + if (ec) |
| 1187 | + return; |
| 1188 | + dump(stream, 0); |
| 1189 | +} |
| 1190 | + |
1180 | 1191 | void Decl::dump(raw_ostream &OS, unsigned Indent) const {
|
1181 | 1192 | // Make sure to print type variables.
|
1182 | 1193 | llvm::SaveAndRestore<bool> X(getASTContext().LangOpts.DebugConstraintSolver,
|
|
0 commit comments