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 | 16094c2467e79ebcfe739da3582283b9d599de54 (patch) | |
tree | 67f63c2d978e4d4ce53fd291ce7032cac866e771 /clang/lib/AST/DeclPrinter.cpp | |
parent | c901392ba4a13e2e1894ea9888938d4d80d80725 (diff) | |
download | bcm5719-llvm-16094c2467e79ebcfe739da3582283b9d599de54.tar.gz bcm5719-llvm-16094c2467e79ebcfe739da3582283b9d599de54.zip |
Added ASTs to destructor decl AST for default destruction of object's
base/members.
llvm-svn: 75849
Diffstat (limited to 'clang/lib/AST/DeclPrinter.cpp')
-rw-r--r-- | clang/lib/AST/DeclPrinter.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index c7ad8d0a711..84ae72977e6 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/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 { |