]> granicus.if.org Git - clang/commitdiff
Don't print 'NULL TYPE' when dumping a delegating constructor.
authorRichard Trieu <rtrieu@google.com>
Fri, 12 Sep 2014 21:20:53 +0000 (21:20 +0000)
committerRichard Trieu <rtrieu@google.com>
Fri, 12 Sep 2014 21:20:53 +0000 (21:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217707 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTDumper.cpp
test/Misc/ast-dump-decl.cpp

index d9dc8b57dfb166e1c9bbc7177699c13a5ec652fc..d134e646eb91a154d944a6104b9233a0f0b0d3ad 100644 (file)
@@ -709,8 +709,12 @@ void ASTDumper::dumpCXXCtorInitializer(const CXXCtorInitializer *Init) {
   if (Init->isAnyMemberInitializer()) {
     OS << ' ';
     dumpBareDeclRef(Init->getAnyMember());
-  } else {
+  } else if (Init->isBaseInitializer()) {
     dumpType(QualType(Init->getBaseClass(), 0));
+  } else if (Init->isDelegatingInitializer()) {
+    dumpType(Init->getTypeSourceInfo()->getType());
+  } else {
+    llvm_unreachable("Unknown initializer type");
   }
   dumpStmt(Init->getInit());
 }
index b41e4ee3d0f05baad452ace53a53bed733425747..fe7ea7503df31dda63578f02e42bc3ac914ec346 100644 (file)
@@ -116,6 +116,7 @@ namespace testCXXConstructorDecl {
   class TestCXXConstructorDecl : public A {
     int I;
     TestCXXConstructorDecl(A &a, int i) : A(a), I(i) { }
+    TestCXXConstructorDecl(A &a) : TestCXXConstructorDecl(a, 0) { }
   };
 }
 // CHECK:      CXXConstructorDecl{{.*}} TestCXXConstructorDecl 'void {{.*}}'
@@ -126,6 +127,10 @@ namespace testCXXConstructorDecl {
 // CHECK:        CXXCtorInitializer{{.*}}I
 // CHECK-NEXT:     Expr
 // CHECK:        CompoundStmt
+// CHECK:      CXXConstructorDecl{{.*}} TestCXXConstructorDecl 'void {{.*}}'
+// CHECK-NEXT:   ParmVarDecl{{.*}} a
+// CHECK-NEXT:   CXXCtorInitializer{{.*}}TestCXXConstructorDecl
+// CHECK-NEXT:     CXXConstructExpr{{.*}}TestCXXConstructorDecl
 
 class TestCXXDestructorDecl {
   ~TestCXXDestructorDecl() { }