aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-02 15:34:35 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-02 15:34:35 +0000
commitf9cce31a1c71e2949cd5f47616a5624f5fedd84d (patch)
tree8a1f483016dd7b08281a527ccb7964818c3e7883
parent1d6107c30194f10cb2c634e9d8f8740d660b1644 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112821 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGExprCXX.cpp5
-rw-r--r--test/CodeGenCXX/delete.cpp10
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp
index 5e417605b1..e0c8280e6b 100644
--- a/lib/CodeGen/CGExprCXX.cpp
+++ b/lib/CodeGen/CGExprCXX.cpp
@@ -1018,8 +1018,9 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) {
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);
diff --git a/test/CodeGenCXX/delete.cpp b/test/CodeGenCXX/delete.cpp
index ec13d0cc0f..1f52a783e6 100644
--- a/test/CodeGenCXX/delete.cpp
+++ b/test/CodeGenCXX/delete.cpp
@@ -95,3 +95,13 @@ namespace test1 {
// 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;
+ }
+}