[cfe-commits] r166311 - in /cfe/trunk: lib/AST/DeclPrinter.cpp test/SemaCXX/ast-print.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Oct 19 13:36:44 PDT 2012
Author: efriedma
Date: Fri Oct 19 15:36:44 2012
New Revision: 166311
URL: http://llvm.org/viewvc/llvm-project?rev=166311&view=rev
Log:
Pretty-print a ParenListExpr in a variable initializer correctly. Patch by Grzegorz Jablonski.
Modified:
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/test/SemaCXX/ast-print.cpp
Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=166311&r1=166310&r2=166311&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Fri Oct 19 15:36:44 2012
@@ -629,13 +629,13 @@
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 << ")";
}
}
Modified: cfe/trunk/test/SemaCXX/ast-print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ast-print.cpp?rev=166311&r1=166310&r2=166311&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/ast-print.cpp (original)
+++ cfe/trunk/test/SemaCXX/ast-print.cpp Fri Oct 19 15:36:44 2012
@@ -52,3 +52,11 @@
unsigned int y = 0;
test6fn((int&)y);
}
+
+// CHECK: S s( 1, 2 );
+
+template <class S> void test7()
+{
+ S s( 1,2 );
+}
+
More information about the cfe-commits
mailing list