]> granicus.if.org Git - clang/commitdiff
Fix a few more ConvertTypes that should be ConvertTypeForMems, fixing
authorDouglas Gregor <dgregor@apple.com>
Thu, 2 Sep 2010 23:24:14 +0000 (23:24 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 2 Sep 2010 23:24:14 +0000 (23:24 +0000)
two regressions in Boost.Config.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112908 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprCXX.cpp
test/CodeGenCXX/new.cpp

index 79e3b220ef97d9fdaa384cc80a8250a413166ba3..a5c16913078d9d94f839a5fb9d4ff71a8ea1a358 100644 (file)
@@ -754,7 +754,8 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) {
                                                    AllocType);
   }
 
-  const llvm::Type *ElementPtrTy = ConvertType(AllocType)->getPointerTo(AS);
+  const llvm::Type *ElementPtrTy
+    = ConvertTypeForMem(AllocType)->getPointerTo(AS);
   NewPtr = Builder.CreateBitCast(NewPtr, ElementPtrTy);
   if (E->isArray()) {
     EmitNewInitializer(*this, E, NewPtr, NumElements, AllocSizeWithoutCookie);
@@ -762,7 +763,7 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) {
     // NewPtr is a pointer to the base element type.  If we're
     // allocating an array of arrays, we'll need to cast back to the
     // array pointer type.
-    const llvm::Type *ResultTy = ConvertType(E->getType());
+    const llvm::Type *ResultTy = ConvertTypeForMem(E->getType());
     if (NewPtr->getType() != ResultTy)
       NewPtr = Builder.CreateBitCast(NewPtr, ResultTy);
   } else {
index d52ebbe45016e109d661dfe3799a43676a17f12f..10a6f7f4890cea161e0c55e5432d593bdd41e084 100644 (file)
@@ -158,4 +158,8 @@ void f() {
   // CHECK: call void @_ZN5AllocD1Ev(
   // CHECK: call void @_ZN5AllocdaEPv(i8*
   delete[] new Alloc[10][20];
+  // CHECK: call noalias i8* @_Znwm
+  // CHECK: call void @_ZdlPv(i8*
+  delete new bool;
+  // CHECK: ret void
 }