mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] Introduce the ASTPrinter class, and have its callbacks invoked during AST printing.
This provides useful extension points during AST printing. Swift SVN r11338
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/AST/AST.h"
|
||||
#include "swift/AST/ASTPrinter.h"
|
||||
#include "swift/AST/ASTVisitor.h"
|
||||
#include "swift/Basic/STLExtras.h"
|
||||
#include "llvm/ADT/APFloat.h"
|
||||
@@ -1446,6 +1447,14 @@ void Expr::print(raw_ostream &OS, unsigned Indent) const {
|
||||
PrintExpr(OS, Indent).visit(const_cast<Expr*>(this));
|
||||
}
|
||||
|
||||
void Expr::print(ASTPrinter &Printer, const PrintOptions &Opts) const {
|
||||
// FIXME: Fully use the ASTPrinter.
|
||||
llvm::SmallString<128> Str;
|
||||
llvm::raw_svector_ostream OS(Str);
|
||||
print(OS);
|
||||
Printer << OS.str();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Printing for TypeRepr and all subclasses.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Reference in New Issue
Block a user