aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCXX.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2011-05-14 23:26:09 +0000
committerAnders Carlsson <andersca@mac.com>2011-05-14 23:26:09 +0000
commitffb945ffb5d29b80fd93649c3572b6d87abce3fc (patch)
treeb2f9cf40b3b751972661f2b3763cbabc636c7fb0 /lib/CodeGen/CGCXX.cpp
parenta83c17c28f4a570e18678f6031834487534f120d (diff)
When emitting the destructor for a class with a vtable, if we can determine
that the destructor body is trivial and that all member variables also have either trivial destructors or trivial destructor bodies, we don't need to initialize the vtable pointers since no virtual member functions will be called on the destructor. Fixes PR9181. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131368 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r--lib/CodeGen/CGCXX.cpp13
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 4390f3a3e3..f6fc202eaa 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/lib/CodeGen/CGCXX.cpp
@@ -28,17 +28,6 @@
using namespace clang;
using namespace CodeGen;
-/// Determines whether the given function has a trivial body that does
-/// not require any specific codegen.
-static bool HasTrivialBody(const FunctionDecl *FD) {
- Stmt *S = FD->getBody();
- if (!S)
- return true;
- if (isa<CompoundStmt>(S) && cast<CompoundStmt>(S)->body_empty())
- return true;
- return false;
-}
-
/// Try to emit a base destructor as an alias to its primary
/// base-class destructor.
bool CodeGenModule::TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) {
@@ -47,7 +36,7 @@ bool CodeGenModule::TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) {
// If the destructor doesn't have a trivial body, we have to emit it
// separately.
- if (!HasTrivialBody(D))
+ if (!D->hasTrivialBody())
return true;
const CXXRecordDecl *Class = D->getParent();