Patch to accomodate Doug's comment on default
destruction of base/members for each destructor AST.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76663 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 47938dc..f13ebd3 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -1463,7 +1463,7 @@
SourceLocation MemberLoc,
IdentifierInfo &Member,
DeclPtrTy ImplDecl);
- virtual void ActOnDefaultCDtorInitializers(DeclPtrTy CDtorDecl);
+ virtual void ActOnDefaultCtorInitializers(DeclPtrTy CDtorDecl);
bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
FunctionDecl *FDecl,
const FunctionProtoType *Proto,
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 989e08e..4674327 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3282,12 +3282,15 @@
// Verify that that gotos and switch cases don't jump into scopes illegally.
if (CurFunctionNeedsScopeChecking)
DiagnoseInvalidJumps(Body);
-
- // C++ constructors that have function-try-blocks can't have return statements
- // in the handlers of that block. (C++ [except.handle]p14) Verify this.
+
+ // C++ constructors that have function-try-blocks can't have return
+ // statements in the handlers of that block. (C++ [except.handle]p14)
+ // Verify this.
if (isa<CXXConstructorDecl>(dcl) && isa<CXXTryStmt>(Body))
DiagnoseReturnInConstructorExceptionHandler(cast<CXXTryStmt>(Body));
-
+
+ if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(dcl))
+ Destructor->computeBaseOrMembersToDestroy(Context);
return D;
}
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index cb62deb..1dcac3f 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -918,7 +918,7 @@
}
}
-void Sema::ActOnDefaultCDtorInitializers(DeclPtrTy CDtorDecl) {
+void Sema::ActOnDefaultCtorInitializers(DeclPtrTy CDtorDecl) {
if (!CDtorDecl)
return;
@@ -926,10 +926,6 @@
= dyn_cast<CXXConstructorDecl>(CDtorDecl.getAs<Decl>()))
Constructor->setBaseOrMemberInitializers(Context,
(CXXBaseOrMemberInitializer **)0, 0);
- else
- if (CXXDestructorDecl *Destructor
- = dyn_cast<CXXDestructorDecl>(CDtorDecl.getAs<Decl>()))
- Destructor->setBaseOrMemberDestructions(Context);
}
namespace {