forked from OSchip/llvm-project
Pretty-print a ParenListExpr in a variable initializer correctly. Patch by Grzegorz Jablonski.
llvm-svn: 166311
This commit is contained in:
parent
46d8fc9d6b
commit
92125c474a
|
@ -629,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 << ")";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,3 +52,11 @@ void test6() {
|
|||
unsigned int y = 0;
|
||||
test6fn((int&)y);
|
||||
}
|
||||
|
||||
// CHECK: S s( 1, 2 );
|
||||
|
||||
template <class S> void test7()
|
||||
{
|
||||
S s( 1,2 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue