[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:
Argyrios Kyrtzidis
2013-12-16 01:26:36 +00:00
parent 04b98c7d67
commit 93c15bed50
15 changed files with 588 additions and 382 deletions

View File

@@ -43,6 +43,7 @@ namespace clang {
namespace swift {
class ArchetypeType;
class ASTContext;
class ASTPrinter;
class ASTWalker;
class Type;
class Expr;
@@ -377,18 +378,14 @@ public:
///
/// \param OS Output stream to which the declaration will be printed.
void print(raw_ostream &OS) const;
void print(raw_ostream &OS, const PrintOptions &Opts) const;
/// \brief Pretty-print the given declaration.
///
/// \param os Output stream to which the declaration will be printed.
/// \param Printer ASTPrinter object.
///
/// \param options Options to control how pretty-printing is performed.
///
/// \param declOffsets If non-null, will be populated with the stream offsets
/// at which each declaration encountered is printed.
void print(raw_ostream &os, const PrintOptions &options,
SmallVectorImpl<std::pair<Decl *, uint64_t>> *declOffsets
= nullptr) const;
/// \param Opts Options to control how pretty-printing is performed.
void print(ASTPrinter &Printer, const PrintOptions &Opts) const;
/// \brief Determine whether this declaration should be printed when
/// encountered in its declaration context's list of members.