aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/StmtPrinter.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-05-30 05:03:24 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-05-30 05:03:24 +0000
commit48d14a222276fad5279e994d1a062f36ae6fcbce (patch)
tree93f9aaec7c2f5c6b41efffb87d9a03aa5c278a84 /lib/AST/StmtPrinter.cpp
parent42f42c0dd5cf71fbfc6fa282d03079a902f6e342 (diff)
Add a Stmt::printPretty overload which takes an ASTContext; start
transitioning callers over to pass one in. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72609 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/StmtPrinter.cpp')
-rw-r--r--lib/AST/StmtPrinter.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index a698688e6c..6d641cf2d9 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -28,15 +28,17 @@ using namespace clang;
namespace {
class VISIBILITY_HIDDEN StmtPrinter : public StmtVisitor<StmtPrinter> {
llvm::raw_ostream &OS;
+ ASTContext &Context;
unsigned IndentLevel;
clang::PrinterHelper* Helper;
PrintingPolicy Policy;
public:
- StmtPrinter(llvm::raw_ostream &os, PrinterHelper* helper,
+ StmtPrinter(llvm::raw_ostream &os, ASTContext &C, PrinterHelper* helper,
const PrintingPolicy &Policy = PrintingPolicy(),
unsigned Indentation = 0)
- : OS(os), IndentLevel(Indentation), Helper(helper), Policy(Policy) {}
+ : OS(os), Context(C), IndentLevel(Indentation), Helper(helper),
+ Policy(Policy) {}
void PrintStmt(Stmt *S) {
PrintStmt(S, Policy.Indentation);
@@ -112,7 +114,7 @@ void StmtPrinter::PrintRawCompoundStmt(CompoundStmt *Node) {
}
void StmtPrinter::PrintRawDecl(Decl *D) {
- D->print(OS, *(ASTContext*)0, Policy, IndentLevel);
+ D->print(OS, Context, Policy, IndentLevel);
}
void StmtPrinter::PrintRawDeclStmt(DeclStmt *S) {
@@ -121,7 +123,7 @@ void StmtPrinter::PrintRawDeclStmt(DeclStmt *S) {
for ( ; Begin != End; ++Begin)
Decls.push_back(*Begin);
- Decl::printGroup(Decls.data(), Decls.size(), OS, *(ASTContext*)0, Policy,
+ Decl::printGroup(Decls.data(), Decls.size(), OS, Context, Policy,
IndentLevel);
}
@@ -1203,11 +1205,12 @@ void StmtPrinter::VisitBlockDeclRefExpr(BlockDeclRefExpr *Node) {
// Stmt method implementations
//===----------------------------------------------------------------------===//
-void Stmt::dumpPretty() const {
- printPretty(llvm::errs(), 0, PrintingPolicy());
+void Stmt::dumpPretty(ASTContext& Context) const {
+ printPretty(llvm::errs(), Context, 0, PrintingPolicy());
}
-void Stmt::printPretty(llvm::raw_ostream &OS, PrinterHelper* Helper,
+void Stmt::printPretty(llvm::raw_ostream &OS, ASTContext& Context,
+ PrinterHelper* Helper,
const PrintingPolicy &Policy,
unsigned Indentation) const {
if (this == 0) {
@@ -1220,7 +1223,7 @@ void Stmt::printPretty(llvm::raw_ostream &OS, PrinterHelper* Helper,
return;
}
- StmtPrinter P(OS, Helper, Policy, Indentation);
+ StmtPrinter P(OS, Context, Helper, Policy, Indentation);
P.Visit(const_cast<Stmt*>(this));
}