Remove the ASTContext parameter from the printing related methods of Decl.
llvm-svn: 74503
This commit is contained in:
parent
4e1a72b37b
commit
8a803cc351
|
@ -347,15 +347,13 @@ public:
|
||||||
/// Destroy - Call destructors and release memory.
|
/// Destroy - Call destructors and release memory.
|
||||||
virtual void Destroy(ASTContext& C);
|
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);
|
unsigned Indentation = 0);
|
||||||
void print(llvm::raw_ostream &Out, ASTContext &Context,
|
|
||||||
const PrintingPolicy &Policy, unsigned Indentation = 0);
|
|
||||||
static void printGroup(Decl** Begin, unsigned NumDecls,
|
static void printGroup(Decl** Begin, unsigned NumDecls,
|
||||||
llvm::raw_ostream &Out, ASTContext &Context,
|
llvm::raw_ostream &Out, const PrintingPolicy &Policy,
|
||||||
const PrintingPolicy &Policy,
|
|
||||||
unsigned Indentation = 0);
|
unsigned Indentation = 0);
|
||||||
void dump(ASTContext &Context);
|
void dump();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Attr *getAttrsImpl() const;
|
const Attr *getAttrsImpl() const;
|
||||||
|
|
|
@ -74,14 +74,13 @@ namespace {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Decl::print(llvm::raw_ostream &Out, ASTContext &Context,
|
void Decl::print(llvm::raw_ostream &Out, unsigned Indentation) {
|
||||||
unsigned Indentation) {
|
print(Out, getASTContext().PrintingPolicy, Indentation);
|
||||||
print(Out, Context, Context.PrintingPolicy, Indentation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Decl::print(llvm::raw_ostream &Out, ASTContext &Context,
|
void Decl::print(llvm::raw_ostream &Out, const PrintingPolicy &Policy,
|
||||||
const PrintingPolicy &Policy, unsigned Indentation) {
|
unsigned Indentation) {
|
||||||
DeclPrinter Printer(Out, Context, Policy, Indentation);
|
DeclPrinter Printer(Out, getASTContext(), Policy, Indentation);
|
||||||
Printer.Visit(this);
|
Printer.Visit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,11 +111,10 @@ static QualType getDeclType(Decl* D) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Decl::printGroup(Decl** Begin, unsigned NumDecls,
|
void Decl::printGroup(Decl** Begin, unsigned NumDecls,
|
||||||
llvm::raw_ostream &Out, ASTContext &Context,
|
llvm::raw_ostream &Out, const PrintingPolicy &Policy,
|
||||||
const PrintingPolicy &Policy,
|
|
||||||
unsigned Indentation) {
|
unsigned Indentation) {
|
||||||
if (NumDecls == 1) {
|
if (NumDecls == 1) {
|
||||||
(*Begin)->print(Out, Context, Policy, Indentation);
|
(*Begin)->print(Out, Policy, Indentation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +125,7 @@ void Decl::printGroup(Decl** Begin, unsigned NumDecls,
|
||||||
|
|
||||||
PrintingPolicy SubPolicy(Policy);
|
PrintingPolicy SubPolicy(Policy);
|
||||||
if (TD && TD->isDefinition()) {
|
if (TD && TD->isDefinition()) {
|
||||||
TD->print(Out, Context, Policy, Indentation);
|
TD->print(Out, Policy, Indentation);
|
||||||
Out << " ";
|
Out << " ";
|
||||||
SubPolicy.SuppressTag = true;
|
SubPolicy.SuppressTag = true;
|
||||||
}
|
}
|
||||||
|
@ -142,12 +140,12 @@ void Decl::printGroup(Decl** Begin, unsigned NumDecls,
|
||||||
SubPolicy.SuppressSpecifiers = true;
|
SubPolicy.SuppressSpecifiers = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*Begin)->print(Out, Context, SubPolicy, Indentation);
|
(*Begin)->print(Out, SubPolicy, Indentation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Decl::dump(ASTContext &Context) {
|
void Decl::dump() {
|
||||||
print(llvm::errs(), Context);
|
print(llvm::errs());
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::raw_ostream& DeclPrinter::Indent() {
|
llvm::raw_ostream& DeclPrinter::Indent() {
|
||||||
|
@ -158,8 +156,7 @@ llvm::raw_ostream& DeclPrinter::Indent() {
|
||||||
|
|
||||||
void DeclPrinter::ProcessDeclGroup(llvm::SmallVectorImpl<Decl*>& Decls) {
|
void DeclPrinter::ProcessDeclGroup(llvm::SmallVectorImpl<Decl*>& Decls) {
|
||||||
this->Indent();
|
this->Indent();
|
||||||
Decl::printGroup(Decls.data(), Decls.size(), Out, Context,
|
Decl::printGroup(Decls.data(), Decls.size(), Out, Policy, Indentation);
|
||||||
Policy, Indentation);
|
|
||||||
Out << ";\n";
|
Out << ";\n";
|
||||||
Decls.clear();
|
Decls.clear();
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ void StmtPrinter::PrintRawCompoundStmt(CompoundStmt *Node) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StmtPrinter::PrintRawDecl(Decl *D) {
|
void StmtPrinter::PrintRawDecl(Decl *D) {
|
||||||
D->print(OS, Context, Policy, IndentLevel);
|
D->print(OS, Policy, IndentLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StmtPrinter::PrintRawDeclStmt(DeclStmt *S) {
|
void StmtPrinter::PrintRawDeclStmt(DeclStmt *S) {
|
||||||
|
@ -123,8 +123,7 @@ void StmtPrinter::PrintRawDeclStmt(DeclStmt *S) {
|
||||||
for ( ; Begin != End; ++Begin)
|
for ( ; Begin != End; ++Begin)
|
||||||
Decls.push_back(*Begin);
|
Decls.push_back(*Begin);
|
||||||
|
|
||||||
Decl::printGroup(Decls.data(), Decls.size(), OS, Context, Policy,
|
Decl::printGroup(Decls.data(), Decls.size(), OS, Policy, IndentLevel);
|
||||||
IndentLevel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StmtPrinter::VisitNullStmt(NullStmt *Node) {
|
void StmtPrinter::VisitNullStmt(NullStmt *Node) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace {
|
||||||
virtual void HandleTranslationUnit(ASTContext &Context) {
|
virtual void HandleTranslationUnit(ASTContext &Context) {
|
||||||
PrintingPolicy Policy = Context.PrintingPolicy;
|
PrintingPolicy Policy = Context.PrintingPolicy;
|
||||||
Policy.Dump = Dump;
|
Policy.Dump = Dump;
|
||||||
Context.getTranslationUnitDecl()->print(Out, Context, Policy);
|
Context.getTranslationUnitDecl()->print(Out, Policy);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
@ -114,7 +114,7 @@ namespace {
|
||||||
|
|
||||||
void ASTViewer::HandleTopLevelSingleDecl(Decl *D) {
|
void ASTViewer::HandleTopLevelSingleDecl(Decl *D) {
|
||||||
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
|
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
|
||||||
FD->print(llvm::errs(), *Context);
|
FD->print(llvm::errs());
|
||||||
|
|
||||||
if (FD->getBodyIfAvailable()) {
|
if (FD->getBodyIfAvailable()) {
|
||||||
llvm::cerr << '\n';
|
llvm::cerr << '\n';
|
||||||
|
@ -125,7 +125,7 @@ void ASTViewer::HandleTopLevelSingleDecl(Decl *D) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
|
if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
|
||||||
MD->print(llvm::errs(), *Context);
|
MD->print(llvm::errs());
|
||||||
|
|
||||||
if (MD->getBody()) {
|
if (MD->getBody()) {
|
||||||
llvm::cerr << '\n';
|
llvm::cerr << '\n';
|
||||||
|
|
|
@ -287,7 +287,7 @@ void LocResolverBase::FixRange(SourceRange &Range) {
|
||||||
void LocResolverBase::print(Decl *D) {
|
void LocResolverBase::print(Decl *D) {
|
||||||
llvm::raw_ostream &OS = llvm::outs();
|
llvm::raw_ostream &OS = llvm::outs();
|
||||||
OS << "#### DECL ####\n";
|
OS << "#### DECL ####\n";
|
||||||
D->print(OS, Ctx);
|
D->print(OS);
|
||||||
OS << " <";
|
OS << " <";
|
||||||
D->getLocStart().print(OS, Ctx.getSourceManager());
|
D->getLocStart().print(OS, Ctx.getSourceManager());
|
||||||
OS << " > - <";
|
OS << " > - <";
|
||||||
|
|
Loading…
Reference in New Issue