From 3923e95280210ef877153f0c3dbab12d6ed2ad43 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sun, 31 May 2009 21:07:58 +0000 Subject: [PATCH] Support for complex types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72675 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGCXX.cpp | 6 ++++-- test/CodeGenCXX/new.cpp | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp index 4b8e733f4d..9e20530711 100644 --- a/lib/CodeGen/CGCXX.cpp +++ b/lib/CodeGen/CGCXX.cpp @@ -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())); } diff --git a/test/CodeGenCXX/new.cpp b/test/CodeGenCXX/new.cpp index a1786e8181..dde7bfe9ee 100644 --- a/test/CodeGenCXX/new.cpp +++ b/test/CodeGenCXX/new.cpp @@ -13,4 +13,6 @@ void t2(int* a) { void t3() { int *a = new int(10); + _Complex int* b = new _Complex int(10i); + } -- 2.40.0