diff options
author | John McCall <rjmccall@apple.com> | 2010-03-03 03:40:11 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-03-03 03:40:11 +0000 |
commit | 1950a11939b31892a97ca93811eb75fdc3835cc5 (patch) | |
tree | 3b3ac7c03623fec5ae812edee773c7c6bb431984 /clang/lib/CodeGen/CGCXX.cpp | |
parent | 4eab008b5a300411ba33363d3a5ba68fad0d0712 (diff) | |
download | bcm5719-llvm-1950a11939b31892a97ca93811eb75fdc3835cc5.tar.gz bcm5719-llvm-1950a11939b31892a97ca93811eb75fdc3835cc5.zip |
Don't emit derived-to-base destructor aliases if we don't have a definition
for the base destructor, because aliases to declarations aren't legal.
Fixes PR 6471.
llvm-svn: 97637
Diffstat (limited to 'clang/lib/CodeGen/CGCXX.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCXX.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index cb8489d2024..4889fc08f48 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -93,12 +93,18 @@ bool CodeGenModule::TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) { if (!UniqueBase) return true; + /// If we don't have a definition for the destructor yet, don't + /// emit. We can't emit aliases to declarations; that's just not + /// how aliases work. + const CXXDestructorDecl *BaseD = UniqueBase->getDestructor(getContext()); + if (!BaseD->isImplicit() && !BaseD->getBody()) + return true; + // If the base is at a non-zero offset, give up. const ASTRecordLayout &ClassLayout = Context.getASTRecordLayout(Class); if (ClassLayout.getBaseClassOffset(UniqueBase) != 0) return true; - const CXXDestructorDecl *BaseD = UniqueBase->getDestructor(getContext()); return TryEmitDefinitionAsAlias(GlobalDecl(D, Dtor_Base), GlobalDecl(BaseD, Dtor_Base)); } |