]> granicus.if.org Git - clang/commitdiff
Minor change to my last patch to fix PR7490.
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 25 Jun 2010 20:01:13 +0000 (20:01 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 25 Jun 2010 20:01:13 +0000 (20:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106875 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprCXX.cpp

index 3e34f2267d4f9aaeb441fd16148a51418cb4bad0..a23dc154c58d99a61938cca2f706cfa857033b43 100644 (file)
@@ -483,9 +483,6 @@ static llvm::Value *EmitCXXNewAllocSize(ASTContext &Context,
 
 static void StoreAnyExprIntoOneUnit(CodeGenFunction &CGF, const CXXNewExpr *E,
                                     llvm::Value *NewPtr) {
-  // We have a POD type.
-  if (E->getNumConstructorArgs() == 0)
-    return;
   
   assert(E->getNumConstructorArgs() == 1 &&
          "Can only have one argument to initializer of POD type.");
@@ -507,6 +504,10 @@ void
 CodeGenFunction::EmitNewArrayInitializer(const CXXNewExpr *E, 
                                          llvm::Value *NewPtr,
                                          llvm::Value *NumElements) {
+  // We have a POD type.
+  if (E->getNumConstructorArgs() == 0)
+    return;
+  
   const llvm::Type *SizeTy = ConvertType(getContext().getSizeType());
   
   // Create a temporary for the loop index and initialize it with 0.
@@ -577,7 +578,10 @@ static void EmitNewInitializer(CodeGenFunction &CGF, const CXXNewExpr *E,
 
     return;
   }
-    
+  // We have a POD type.
+  if (E->getNumConstructorArgs() == 0)
+    return;
+  
   StoreAnyExprIntoOneUnit(CGF, E, NewPtr);
 }