diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-15 22:34:08 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-07-15 22:34:08 +0000 |
commit | 560de45ccbf21c5e4dbeef3fc49f932e499cc181 (patch) | |
tree | f9d477eeec5d7b350031c47efa84bea707e325d5 /lib/AST/DeclPrinter.cpp | |
parent | fde2efe96e00c5d03e7caaf0c1e67d7b011d9d0c (diff) |
Added ASTs to destructor decl AST for default destruction of object's
base/members.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclPrinter.cpp')
-rw-r--r-- | lib/AST/DeclPrinter.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index c7ad8d0a71..84ae72977e 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -374,6 +374,36 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { } } } + else if (CXXDestructorDecl *DDecl = dyn_cast<CXXDestructorDecl>(D)) { + if (DDecl->getNumBaseOrMemberDestructions() > 0) { + // FIXME. This is strictly for visualization of destructor's AST for + // how base/members are destructed. It has no other validity. + assert (D->isThisDeclarationADefinition() && "Destructor with dtor-list"); + Proto += " : "; + for (CXXDestructorDecl::destr_const_iterator B = DDecl->destr_begin(), + E = DDecl->destr_end(); + B != E; ++B) { + CXXBaseOrMemberInitializer * BMInitializer = (*B); + if (B != DDecl->destr_begin()) + Proto += ", "; + + if (BMInitializer->isMemberInitializer()) { + FieldDecl *FD = BMInitializer->getMember(); + Proto += "~"; + Proto += FD->getNameAsString(); + } + else // FIXME. skip dependent types for now. + if (const RecordType *RT = + BMInitializer->getBaseClass()->getAsRecordType()) { + const CXXRecordDecl *BaseDecl = + cast<CXXRecordDecl>(RT->getDecl()); + Proto += "~"; + Proto += BaseDecl->getNameAsString(); + } + Proto += "()"; + } + } + } else AFT->getResultType().getAsStringInternal(Proto, Policy); } else { |