diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2012-10-19 20:36:44 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2012-10-19 20:36:44 +0000 |
| commit | 92125c474a4d268265eb2ea5f3733cdfa1c14a2e (patch) | |
| tree | 3ca9f20320af970a4644bfa304ea5c67e65973d0 | |
| parent | 46d8fc9d6b6b2f6e1f3a52a8667bf79d7a46452d (diff) | |
| download | bcm5719-llvm-92125c474a4d268265eb2ea5f3733cdfa1c14a2e.tar.gz bcm5719-llvm-92125c474a4d268265eb2ea5f3733cdfa1c14a2e.zip | |
Pretty-print a ParenListExpr in a variable initializer correctly. Patch by Grzegorz Jablonski.
llvm-svn: 166311
| -rw-r--r-- | clang/lib/AST/DeclPrinter.cpp | 4 | ||||
| -rw-r--r-- | clang/test/SemaCXX/ast-print.cpp | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index 45280df812f..386ad66c991 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -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 << ")"; } } diff --git a/clang/test/SemaCXX/ast-print.cpp b/clang/test/SemaCXX/ast-print.cpp index 5e89c8b5488..e0c154a0ecb 100644 --- a/clang/test/SemaCXX/ast-print.cpp +++ b/clang/test/SemaCXX/ast-print.cpp @@ -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 ); +} + |

