r295689 - Add template parameter depth and index to -ast-dump output.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 20 18:04:04 PST 2017


Author: rsmith
Date: Mon Feb 20 20:04:03 2017
New Revision: 295689

URL: http://llvm.org/viewvc/llvm-project?rev=295689&view=rev
Log:
Add template parameter depth and index to -ast-dump output.

Modified:
    cfe/trunk/lib/AST/ASTDumper.cpp
    cfe/trunk/test/Misc/ast-dump-decl.cpp
    cfe/trunk/test/SemaTemplate/default-expr-arguments-3.cpp

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=295689&r1=295688&r2=295689&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Mon Feb 20 20:04:03 2017
@@ -1463,6 +1463,7 @@ void ASTDumper::VisitTemplateTypeParmDec
     OS << " typename";
   else
     OS << " class";
+  OS << " depth " << D->getDepth() << " index " << D->getIndex();
   if (D->isParameterPack())
     OS << " ...";
   dumpName(D);
@@ -1472,6 +1473,7 @@ void ASTDumper::VisitTemplateTypeParmDec
 
 void ASTDumper::VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D) {
   dumpType(D->getType());
+  OS << " depth " << D->getDepth() << " index " << D->getIndex();
   if (D->isParameterPack())
     OS << " ...";
   dumpName(D);
@@ -1481,6 +1483,7 @@ void ASTDumper::VisitNonTypeTemplateParm
 
 void ASTDumper::VisitTemplateTemplateParmDecl(
     const TemplateTemplateParmDecl *D) {
+  OS << " depth " << D->getDepth() << " index " << D->getIndex();
   if (D->isParameterPack())
     OS << " ...";
   dumpName(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=295689&r1=295688&r2=295689&view=diff
==============================================================================
--- cfe/trunk/test/Misc/ast-dump-decl.cpp (original)
+++ cfe/trunk/test/Misc/ast-dump-decl.cpp Mon Feb 20 20:04:03 2017
@@ -355,8 +355,8 @@ namespace TestTemplateTypeParmDecl {
 }
 // CHECK:      NamespaceDecl{{.*}} TestTemplateTypeParmDecl
 // CHECK-NEXT:   FunctionTemplateDecl
-// CHECK-NEXT:     TemplateTypeParmDecl{{.*}} typename ... T
-// CHECK-NEXT:     TemplateTypeParmDecl{{.*}} class U
+// CHECK-NEXT:     TemplateTypeParmDecl{{.*}} typename depth 0 index 0 ... T
+// CHECK-NEXT:     TemplateTypeParmDecl{{.*}} class depth 0 index 1 U
 // CHECK-NEXT:       TemplateArgument type 'int'
 
 namespace TestNonTypeTemplateParmDecl {
@@ -364,10 +364,10 @@ namespace TestNonTypeTemplateParmDecl {
 }
 // CHECK:      NamespaceDecl{{.*}} TestNonTypeTemplateParmDecl
 // CHECK-NEXT:   FunctionTemplateDecl
-// CHECK-NEXT:     NonTypeTemplateParmDecl{{.*}} 'int' I
+// CHECK-NEXT:     NonTypeTemplateParmDecl{{.*}} 'int' depth 0 index 0 I
 // CHECK-NEXT:       TemplateArgument expr
 // CHECK-NEXT:         IntegerLiteral{{.*}} 'int' 1
-// CHECK-NEXT:     NonTypeTemplateParmDecl{{.*}} 'int' ... J
+// CHECK-NEXT:     NonTypeTemplateParmDecl{{.*}} 'int' depth 0 index 1 ... J
 
 namespace TestTemplateTemplateParmDecl {
   template<typename T> class A;

Modified: cfe/trunk/test/SemaTemplate/default-expr-arguments-3.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/default-expr-arguments-3.cpp?rev=295689&r1=295688&r2=295689&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/default-expr-arguments-3.cpp (original)
+++ cfe/trunk/test/SemaTemplate/default-expr-arguments-3.cpp Mon Feb 20 20:04:03 2017
@@ -37,7 +37,7 @@ template <class T> struct class2 {
 template struct class2<int>;
 
 // CHECK: FunctionTemplateDecl {{.*}} f1
-// CHECK-NEXT: TemplateTypeParmDecl {{.*}} typename T
+// CHECK-NEXT: TemplateTypeParmDecl {{.*}} typename depth 0 index 0 T
 // CHECK-NEXT: FunctionDecl {{.*}} f1 'void (void)'
 // CHECK: FunctionDecl {{.*}} f1 'void (void)'
 // CHECK-NEXT: TemplateArgument type 'int'




More information about the cfe-commits mailing list