Never suppress specifiers when printing the parameters of a function
declaration. llvm-svn: 72613
This commit is contained in:
parent
c4fc839c57
commit
2d042f1cf4
|
@ -296,6 +296,8 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
|
|||
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 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
|
|||
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 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
|
|||
// 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';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,6 +138,8 @@ void f4(int a0, int a1, int a2, va_list ap) {
|
|||
_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
|
||||
|
|
Loading…
Reference in New Issue