[cfe-commits] r72675 - in /cfe/trunk: lib/CodeGen/CGCXX.cpp test/CodeGenCXX/new.cpp

Anders Carlsson andersca at mac.com
Sun May 31 14:07:58 PDT 2009


Author: andersca
Date: Sun May 31 16:07:58 2009
New Revision: 72675

URL: http://llvm.org/viewvc/llvm-project?rev=72675&view=rev
Log:
Support for complex types.

Modified:
    cfe/trunk/lib/CodeGen/CGCXX.cpp
    cfe/trunk/test/CodeGenCXX/new.cpp

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=72675&r1=72674&r2=72675&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Sun May 31 16:07:58 2009
@@ -295,9 +295,11 @@
 
       const Expr *Init = E->getConstructorArg(0);
     
-      if (!hasAggregateLLVMType(AllocType)) {
+      if (!hasAggregateLLVMType(AllocType)) 
         Builder.CreateStore(EmitScalarExpr(Init), NewPtr);
-      } else {
+      else if (AllocType->isAnyComplexType())
+        EmitComplexExprIntoAddr(Init, NewPtr, AllocType.isVolatileQualified());
+      else {
         ErrorUnsupported(E, "new expression");
         return llvm::UndefValue::get(ConvertType(E->getType()));
       }

Modified: cfe/trunk/test/CodeGenCXX/new.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/new.cpp?rev=72675&r1=72674&r2=72675&view=diff

==============================================================================
--- cfe/trunk/test/CodeGenCXX/new.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/new.cpp Sun May 31 16:07:58 2009
@@ -13,4 +13,6 @@
 
 void t3() {
   int *a = new int(10);
+  _Complex int* b = new _Complex int(10i);
+  
 }





More information about the cfe-commits mailing list