summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclPrinter.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
commitef334fdfa2a461491301d23ad5f17942ec845d92 (patch)
treeed1f8a770c200a3a11d6c4d3f3f0bab62c2a9611 /clang/lib/AST/DeclPrinter.cpp
parent796358498f5457a8aad0f3898f1bc4ebb180bf6a (diff)
downloadbcm5719-llvm-ef334fdfa2a461491301d23ad5f17942ec845d92.tar.gz
bcm5719-llvm-ef334fdfa2a461491301d23ad5f17942ec845d92.zip
Add a Stmt::printPretty overload which takes an ASTContext; start
transitioning callers over to pass one in. llvm-svn: 72609
Diffstat (limited to 'clang/lib/AST/DeclPrinter.cpp')
-rw-r--r--clang/lib/AST/DeclPrinter.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 950dd9e223d..72f97035ef1 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -172,6 +172,11 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) {
for (DeclContext::decl_iterator D = DC->decls_begin(Context),
DEnd = DC->decls_end(Context);
D != DEnd; ++D) {
+ if (!Policy.Dump) {
+ // Skip over implicit declarations in pretty-printing mode.
+ if (D->isImplicit()) continue;
+ }
+
// The next bits of code handles stuff like "struct {int x;} a,b"; we're
// forced to merge the declarations because there's no other way to
// refer to the struct in question. This limited merging is safe without
@@ -274,7 +279,7 @@ void DeclPrinter::VisitEnumConstantDecl(EnumConstantDecl *D) {
Out << D->getNameAsString();
if (Expr *Init = D->getInitExpr()) {
Out << " = ";
- Init->printPretty(Out, 0, Policy, Indentation);
+ Init->printPretty(Out, Context, 0, Policy, Indentation);
}
}
@@ -347,7 +352,7 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
} else
Out << ' ';
- D->getBody(Context)->printPretty(Out, 0, Policy, Indentation);
+ D->getBody(Context)->printPretty(Out, Context, 0, Policy, Indentation);
Out << '\n';
}
}
@@ -362,7 +367,7 @@ void DeclPrinter::VisitFieldDecl(FieldDecl *D) {
if (D->isBitField()) {
Out << " : ";
- D->getBitWidth()->printPretty(Out, 0, Policy, Indentation);
+ D->getBitWidth()->printPretty(Out, Context, 0, Policy, Indentation);
}
}
@@ -384,7 +389,7 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) {
Out << "(";
else
Out << " = ";
- D->getInit()->printPretty(Out, 0, Policy, Indentation);
+ D->getInit()->printPretty(Out, Context, 0, Policy, Indentation);
if (D->hasCXXDirectInitializer())
Out << ")";
}
@@ -396,7 +401,7 @@ void DeclPrinter::VisitParmVarDecl(ParmVarDecl *D) {
void DeclPrinter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
Out << "__asm (";
- D->getAsmString()->printPretty(Out, 0, Policy, Indentation);
+ D->getAsmString()->printPretty(Out, Context, 0, Policy, Indentation);
Out << ")";
}
@@ -475,7 +480,7 @@ void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) {
if (OMD->getBody()) {
Out << ' ';
- OMD->getBody()->printPretty(Out, 0, Policy);
+ OMD->getBody()->printPretty(Out, Context, 0, Policy);
Out << '\n';
}
}
OpenPOWER on IntegriCloud