From: Anders Carlsson Date: Sun, 31 May 2009 21:07:58 +0000 (+0000) Subject: Support for complex types. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3923e95280210ef877153f0c3dbab12d6ed2ad43;p=clang Support for complex types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72675 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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); + }