[cfe-commits] r72613 - in /cfe/trunk: lib/AST/DeclPrinter.cpp test/Coverage/c-language-features.inc
Douglas Gregor
dgregor at apple.com
Fri May 29 22:39:39 PDT 2009
Author: dgregor
Date: Sat May 30 00:39:39 2009
New Revision: 72613
URL: http://llvm.org/viewvc/llvm-project?rev=72613&view=rev
Log:
Never suppress specifiers when printing the parameters of a function
declaration.
Modified:
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/test/Coverage/c-language-features.inc
Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=72613&r1=72612&r2=72613&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Sat May 30 00:39:39 2009
@@ -296,6 +296,8 @@
if (D->isVirtualAsWritten()) Out << "virtual ";
}
+ PrintingPolicy SubPolicy(Policy);
+ SubPolicy.SuppressSpecifiers = false;
std::string Proto = D->getNameAsString();
if (isa<FunctionType>(D->getType().getTypePtr())) {
const FunctionType *AFT = D->getType()->getAsFunctionType();
@@ -307,7 +309,7 @@
Proto += "(";
if (FT) {
llvm::raw_string_ostream POut(Proto);
- DeclPrinter ParamPrinter(POut, Context, Policy, Indentation);
+ DeclPrinter ParamPrinter(POut, Context, SubPolicy, Indentation);
for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) {
if (i) POut << ", ";
ParamPrinter.VisitParmVarDecl(D->getParamDecl(i));
@@ -342,17 +344,18 @@
// This is a K&R function definition, so we need to print the
// parameters.
Out << '\n';
+ DeclPrinter ParamPrinter(Out, Context, SubPolicy, Indentation);
Indentation += Policy.Indentation;
for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) {
Indent();
- VisitParmVarDecl(D->getParamDecl(i));
+ ParamPrinter.VisitParmVarDecl(D->getParamDecl(i));
Out << ";\n";
}
Indentation -= Policy.Indentation;
} else
Out << ' ';
- D->getBody(Context)->printPretty(Out, Context, 0, Policy, Indentation);
+ D->getBody(Context)->printPretty(Out, Context, 0, SubPolicy, Indentation);
Out << '\n';
}
}
Modified: cfe/trunk/test/Coverage/c-language-features.inc
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Coverage/c-language-features.inc?rev=72613&r1=72612&r2=72613&view=diff
==============================================================================
--- cfe/trunk/test/Coverage/c-language-features.inc (original)
+++ cfe/trunk/test/Coverage/c-language-features.inc Sat May 30 00:39:39 2009
@@ -138,6 +138,8 @@
_Complex float t32_a, t32_b;
int t32_cond;
int t32 = __real (t32_cond ? t32_a : t32_b);
+
+ struct { int x, y; } t33, *t34, t35[12], t36(int, float);
}
// Extended vectors
More information about the cfe-commits
mailing list