r204572 - Consistently dump default template arguments for template parameters as 'TemplateArgument's.

Richard Smith richard-llvm at metafoo.co.uk
Sun Mar 23 13:50:39 PDT 2014


Author: rsmith
Date: Sun Mar 23 15:50:39 2014
New Revision: 204572

URL: http://llvm.org/viewvc/llvm-project?rev=204572&view=rev
Log:
Consistently dump default template arguments for template parameters as 'TemplateArgument's.

Modified:
    cfe/trunk/lib/AST/ASTDumper.cpp
    cfe/trunk/test/Misc/ast-dump-decl.cpp

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=204572&r1=204571&r2=204572&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Sun Mar 23 15:50:39 2014
@@ -1188,8 +1188,10 @@ void ASTDumper::VisitTemplateTypeParmDec
   if (D->isParameterPack())
     OS << " ...";
   dumpName(D);
-  if (D->hasDefaultArgument())
-    dumpType(D->getDefaultArgument());
+  if (D->hasDefaultArgument()) {
+    lastChild();
+    dumpTemplateArgument(D->getDefaultArgument());
+  }
 }
 
 void ASTDumper::VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D) {
@@ -1197,8 +1199,10 @@ void ASTDumper::VisitNonTypeTemplateParm
   if (D->isParameterPack())
     OS << " ...";
   dumpName(D);
-  if (D->hasDefaultArgument())
-    dumpStmt(D->getDefaultArgument());
+  if (D->hasDefaultArgument()) {
+    lastChild();
+    dumpTemplateArgument(D->getDefaultArgument());
+  }
 }
 
 void ASTDumper::VisitTemplateTemplateParmDecl(
@@ -1207,8 +1211,10 @@ void ASTDumper::VisitTemplateTemplatePar
     OS << " ...";
   dumpName(D);
   dumpTemplateParameters(D->getTemplateParameters());
-  if (D->hasDefaultArgument())
+  if (D->hasDefaultArgument()) {
+    lastChild();
     dumpTemplateArgumentLoc(D->getDefaultArgument());
+  }
 }
 
 void ASTDumper::VisitUsingDecl(const UsingDecl *D) {

Modified: cfe/trunk/test/Misc/ast-dump-decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/ast-dump-decl.cpp?rev=204572&r1=204571&r2=204572&view=diff
==============================================================================
--- cfe/trunk/test/Misc/ast-dump-decl.cpp (original)
+++ cfe/trunk/test/Misc/ast-dump-decl.cpp Sun Mar 23 15:50:39 2014
@@ -308,7 +308,8 @@ namespace TestTemplateTypeParmDecl {
 // CHECK:      NamespaceDecl{{.*}} TestTemplateTypeParmDecl
 // CHECK-NEXT:   FunctionTemplateDecl
 // CHECK-NEXT:     TemplateTypeParmDecl{{.*}} typename ... T
-// CHECK-NEXT:     TemplateTypeParmDecl{{.*}} class U 'int'
+// CHECK-NEXT:     TemplateTypeParmDecl{{.*}} class U
+// CHECK-NEXT:       TemplateArgument type 'int'
 
 namespace TestNonTypeTemplateParmDecl {
   template<int I = 1, int ... J> void foo();
@@ -316,7 +317,8 @@ namespace TestNonTypeTemplateParmDecl {
 // CHECK:      NamespaceDecl{{.*}} TestNonTypeTemplateParmDecl
 // CHECK-NEXT:   FunctionTemplateDecl
 // CHECK-NEXT:     NonTypeTemplateParmDecl{{.*}} 'int' I
-// CHECK-NEXT:       IntegerLiteral{{.*}} 'int' 1
+// CHECK-NEXT:       TemplateArgument expr
+// CHECK-NEXT:         IntegerLiteral{{.*}} 'int' 1
 // CHECK-NEXT:     NonTypeTemplateParmDecl{{.*}} 'int' ... J
 
 namespace TestTemplateTemplateParmDecl {





More information about the cfe-commits mailing list