]> granicus.if.org Git - clang/commitdiff
Support for complex types.
authorAnders Carlsson <andersca@mac.com>
Sun, 31 May 2009 21:07:58 +0000 (21:07 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 31 May 2009 21:07:58 +0000 (21:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72675 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 4b8e733f4d67f830eb15f3728023d7acf49b0c9b..9e20530711032e6fc058df1ab77cf03c2e4e9e1a 100644 (file)
@@ -295,9 +295,11 @@ llvm::Value *CodeGenFunction::EmitCXXNewExpr(const CXXNewExpr *E) {
 
       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()));
       }
index a1786e81817f1553e485257694ceca02b7890168..dde7bfe9ee57f2426dd796de3e10af8716231f65 100644 (file)
@@ -13,4 +13,6 @@ void t2(int* a) {
 
 void t3() {
   int *a = new int(10);
+  _Complex int* b = new _Complex int(10i);
+  
 }