r191839 - Fix crashes when creating global instances of polymorphic classes without fields
Timur Iskhodzhanov
timurrrr at google.com
Wed Oct 2 09:03:16 PDT 2013
Author: timurrrr
Date: Wed Oct 2 11:03:16 2013
New Revision: 191839
URL: http://llvm.org/viewvc/llvm-project?rev=191839&view=rev
Log:
Fix crashes when creating global instances of polymorphic classes without fields
Reviewed at http://llvm-reviews.chandlerc.com/D1795
Modified:
cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
cfe/trunk/test/CodeGenCXX/destructor-exception-spec.cpp
Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=191839&r1=191838&r2=191839&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Wed Oct 2 11:03:16 2013
@@ -96,7 +96,8 @@ static void EmitDeclDestroy(CodeGenFunct
CXXDestructorDecl *dtor = record->getDestructor();
function = CGM.GetAddrOfCXXDestructor(dtor, Dtor_Complete);
- argument = addr;
+ argument = llvm::ConstantExpr::getBitCast(
+ addr, CGF.getTypes().ConvertType(type)->getPointerTo());
// Otherwise, the standard logic requires a helper function.
} else {
Modified: cfe/trunk/test/CodeGenCXX/destructor-exception-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/destructor-exception-spec.cpp?rev=191839&r1=191838&r2=191839&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/destructor-exception-spec.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/destructor-exception-spec.cpp Wed Oct 2 11:03:16 2013
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -emit-llvm-only %s -std=c++11
+// RUN: %clang_cc1 -emit-llvm-only -fno-use-cxa-atexit %s -std=c++11
+// RUN: %clang_cc1 -cxx-abi microsoft -fno-rtti -emit-llvm-only %s -std=c++11
// PR13479: don't crash with -fno-exceptions.
namespace {
More information about the cfe-commits
mailing list