r217707 - Don't print 'NULL TYPE' when dumping a delegating constructor.

Richard Trieu rtrieu at google.com
Fri Sep 12 14:20:53 PDT 2014


Author: rtrieu
Date: Fri Sep 12 16:20:53 2014
New Revision: 217707

URL: http://llvm.org/viewvc/llvm-project?rev=217707&view=rev
Log:
Don't print 'NULL TYPE' when dumping a delegating constructor.

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=217707&r1=217706&r2=217707&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Fri Sep 12 16:20:53 2014
@@ -709,8 +709,12 @@ void ASTDumper::dumpCXXCtorInitializer(c
   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());
 }

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=217707&r1=217706&r2=217707&view=diff
==============================================================================
--- cfe/trunk/test/Misc/ast-dump-decl.cpp (original)
+++ cfe/trunk/test/Misc/ast-dump-decl.cpp Fri Sep 12 16:20:53 2014
@@ -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() { }





More information about the cfe-commits mailing list