/// Destroy - Call destructors and release memory.
virtual void Destroy(ASTContext& C);
- void print(llvm::raw_ostream &Out, ASTContext &Context,
+ void print(llvm::raw_ostream &Out, unsigned Indentation = 0);
+ void print(llvm::raw_ostream &Out, const PrintingPolicy &Policy,
unsigned Indentation = 0);
- void print(llvm::raw_ostream &Out, ASTContext &Context,
- const PrintingPolicy &Policy, unsigned Indentation = 0);
static void printGroup(Decl** Begin, unsigned NumDecls,
- llvm::raw_ostream &Out, ASTContext &Context,
- const PrintingPolicy &Policy,
+ llvm::raw_ostream &Out, const PrintingPolicy &Policy,
unsigned Indentation = 0);
- void dump(ASTContext &Context);
+ void dump();
private:
const Attr *getAttrsImpl() const;
};
}
-void Decl::print(llvm::raw_ostream &Out, ASTContext &Context,
- unsigned Indentation) {
- print(Out, Context, Context.PrintingPolicy, Indentation);
+void Decl::print(llvm::raw_ostream &Out, unsigned Indentation) {
+ print(Out, getASTContext().PrintingPolicy, Indentation);
}
-void Decl::print(llvm::raw_ostream &Out, ASTContext &Context,
- const PrintingPolicy &Policy, unsigned Indentation) {
- DeclPrinter Printer(Out, Context, Policy, Indentation);
+void Decl::print(llvm::raw_ostream &Out, const PrintingPolicy &Policy,
+ unsigned Indentation) {
+ DeclPrinter Printer(Out, getASTContext(), Policy, Indentation);
Printer.Visit(this);
}
}
void Decl::printGroup(Decl** Begin, unsigned NumDecls,
- llvm::raw_ostream &Out, ASTContext &Context,
- const PrintingPolicy &Policy,
+ llvm::raw_ostream &Out, const PrintingPolicy &Policy,
unsigned Indentation) {
if (NumDecls == 1) {
- (*Begin)->print(Out, Context, Policy, Indentation);
+ (*Begin)->print(Out, Policy, Indentation);
return;
}
PrintingPolicy SubPolicy(Policy);
if (TD && TD->isDefinition()) {
- TD->print(Out, Context, Policy, Indentation);
+ TD->print(Out, Policy, Indentation);
Out << " ";
SubPolicy.SuppressTag = true;
}
SubPolicy.SuppressSpecifiers = true;
}
- (*Begin)->print(Out, Context, SubPolicy, Indentation);
+ (*Begin)->print(Out, SubPolicy, Indentation);
}
}
-void Decl::dump(ASTContext &Context) {
- print(llvm::errs(), Context);
+void Decl::dump() {
+ print(llvm::errs());
}
llvm::raw_ostream& DeclPrinter::Indent() {
void DeclPrinter::ProcessDeclGroup(llvm::SmallVectorImpl<Decl*>& Decls) {
this->Indent();
- Decl::printGroup(Decls.data(), Decls.size(), Out, Context,
- Policy, Indentation);
+ Decl::printGroup(Decls.data(), Decls.size(), Out, Policy, Indentation);
Out << ";\n";
Decls.clear();
}
void StmtPrinter::PrintRawDecl(Decl *D) {
- D->print(OS, Context, Policy, IndentLevel);
+ D->print(OS, Policy, IndentLevel);
}
void StmtPrinter::PrintRawDeclStmt(DeclStmt *S) {
for ( ; Begin != End; ++Begin)
Decls.push_back(*Begin);
- Decl::printGroup(Decls.data(), Decls.size(), OS, Context, Policy,
- IndentLevel);
+ Decl::printGroup(Decls.data(), Decls.size(), OS, Policy, IndentLevel);
}
void StmtPrinter::VisitNullStmt(NullStmt *Node) {
virtual void HandleTranslationUnit(ASTContext &Context) {
PrintingPolicy Policy = Context.PrintingPolicy;
Policy.Dump = Dump;
- Context.getTranslationUnitDecl()->print(Out, Context, Policy);
+ Context.getTranslationUnitDecl()->print(Out, Policy);
}
};
} // end anonymous namespace
void ASTViewer::HandleTopLevelSingleDecl(Decl *D) {
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
- FD->print(llvm::errs(), *Context);
+ FD->print(llvm::errs());
if (FD->getBodyIfAvailable()) {
llvm::cerr << '\n';
}
if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
- MD->print(llvm::errs(), *Context);
+ MD->print(llvm::errs());
if (MD->getBody()) {
llvm::cerr << '\n';