[cfe-commits] r112821 - in /cfe/trunk: lib/CodeGen/CGExprCXX.cpp test/CodeGenCXX/delete.cpp
Douglas Gregor
dgregor at apple.com
Thu Sep 2 08:34:35 PDT 2010
Author: dgregor
Date: Thu Sep 2 10:34:35 2010
New Revision: 112821
URL: http://llvm.org/viewvc/llvm-project?rev=112821&view=rev
Log:
Fix more i1/i8 pointer madness. Here, an overactive assertion
complains when the element type of a C++ "delete" expression is
different from what we would expect from the pointer type. When
deleting a bool*, we end up with an i1 on one side (where we compute
the LLVM type from the Clang bool type) and i8 on the other (where we
grab the LLVM type from the LLVM pointer type). I've weakened the
assertion appropriately, and the Boost Parallel Graph Library now
passes its regression tests.
Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/test/CodeGenCXX/delete.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=112821&r1=112820&r2=112821&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Thu Sep 2 10:34:35 2010
@@ -1018,8 +1018,9 @@
Ptr = Builder.CreateInBoundsGEP(Ptr, GEP.begin(), GEP.end(), "del.first");
}
- assert(ConvertType(DeleteTy) ==
- cast<llvm::PointerType>(Ptr->getType())->getElementType());
+ assert(DeleteTy->isBooleanType() ||
+ (ConvertType(DeleteTy) ==
+ cast<llvm::PointerType>(Ptr->getType())->getElementType()));
if (E->isArrayForm()) {
EmitArrayDelete(*this, E->getOperatorDelete(), Ptr, DeleteTy);
Modified: cfe/trunk/test/CodeGenCXX/delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/delete.cpp?rev=112821&r1=112820&r2=112821&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/delete.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/delete.cpp Thu Sep 2 10:34:35 2010
@@ -95,3 +95,13 @@
// CHECK: call void @_ZdaPv(i8* [[ALLOC]])
}
}
+
+namespace test2 {
+ // CHECK: define void @_ZN5test21fEPb
+ void f(bool *b) {
+ // CHECK: call void @_ZdlPv(i8*
+ delete b;
+ // CHECK: call void @_ZdaPv(i8*
+ delete [] b;
+ }
+}
More information about the cfe-commits
mailing list