diff options
Diffstat (limited to 'lib/AST/DeclPrinter.cpp')
-rw-r--r-- | lib/AST/DeclPrinter.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index 7f47604..386ad66 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -105,6 +105,8 @@ static QualType GetBaseType(QualType T) { break; else if (const PointerType* PTy = BaseType->getAs<PointerType>()) BaseType = PTy->getPointeeType(); + else if (const BlockPointerType *BPy = BaseType->getAs<BlockPointerType>()) + BaseType = BPy->getPointeeType(); else if (const ArrayType* ATy = dyn_cast<ArrayType>(BaseType)) BaseType = ATy->getElementType(); else if (const FunctionType* FTy = BaseType->getAs<FunctionType>()) @@ -189,6 +191,9 @@ raw_ostream& DeclPrinter::Indent(unsigned Indentation) { } void DeclPrinter::prettyPrintAttributes(Decl *D) { + if (Policy.SuppressAttributes) + return; + if (D->hasAttrs()) { AttrVec &Attrs = D->getAttrs(); for (AttrVec::const_iterator i=Attrs.begin(), e=Attrs.end(); i!=e; ++i) { @@ -220,6 +225,9 @@ void DeclPrinter::Print(AccessSpecifier AS) { //---------------------------------------------------------------------------- void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) { + if (Policy.TerseOutput) + return; + if (Indent) Indentation += Policy.Indentation; @@ -459,7 +467,7 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { if (I) Proto += ", "; - Proto += FT->getExceptionType(I).getAsString(SubPolicy);; + Proto += FT->getExceptionType(I).getAsString(SubPolicy); } Proto += ")"; } else if (FT && isNoexceptExceptionSpec(FT->getExceptionSpecType())) { @@ -550,7 +558,7 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { Out << " = 0"; else if (D->isDeletedAsWritten()) Out << " = delete"; - else if (D->doesThisDeclarationHaveABody()) { + else if (D->doesThisDeclarationHaveABody() && !Policy.TerseOutput) { if (!D->hasPrototype() && D->getNumParams()) { // This is a K&R function definition, so we need to print the // parameters. @@ -621,13 +629,13 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) { ImplicitInit = D->getInitStyle() == VarDecl::CallInit && Construct->getNumArgs() == 0 && !Construct->isListInitialization(); if (!ImplicitInit) { - if (D->getInitStyle() == VarDecl::CallInit) + if ((D->getInitStyle() == VarDecl::CallInit) && !isa<ParenListExpr>(Init)) Out << "("; else if (D->getInitStyle() == VarDecl::CInit) { Out << " = "; } Init->printPretty(Out, 0, Policy, Indentation); - if (D->getInitStyle() == VarDecl::CallInit) + if ((D->getInitStyle() == VarDecl::CallInit) && !isa<ParenListExpr>(Init)) Out << ")"; } } @@ -869,7 +877,7 @@ void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) { if (OMD->isVariadic()) Out << ", ..."; - if (OMD->getBody()) { + if (OMD->getBody() && !Policy.TerseOutput) { Out << ' '; OMD->getBody()->printPretty(Out, 0, Policy); Out << '\n'; |