[cfe-commits] r89613 - in /cfe/trunk: lib/CodeGen/CGCXXExpr.cpp test/CodeGenCXX/new.cpp
Anders Carlsson
andersca at mac.com
Sun Nov 22 11:25:33 PST 2009
Author: andersca
Date: Sun Nov 22 13:25:33 2009
New Revision: 89613
URL: http://llvm.org/viewvc/llvm-project?rev=89613&view=rev
Log:
Use EmitStoreOfScalar when copying the scalar to the space allocated by 'new'.
Modified:
cfe/trunk/lib/CodeGen/CGCXXExpr.cpp
cfe/trunk/test/CodeGenCXX/new.cpp
Modified: cfe/trunk/lib/CodeGen/CGCXXExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXXExpr.cpp?rev=89613&r1=89612&r2=89613&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXXExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXXExpr.cpp Sun Nov 22 13:25:33 2009
@@ -103,8 +103,9 @@
const Expr *Init = E->getConstructorArg(0);
- if (!CGF.hasAggregateLLVMType(AllocType))
- CGF.Builder.CreateStore(CGF.EmitScalarExpr(Init), NewPtr);
+ if (!CGF.hasAggregateLLVMType(AllocType))
+ CGF.EmitStoreOfScalar(CGF.EmitScalarExpr(Init), NewPtr,
+ AllocType.isVolatileQualified(), AllocType);
else if (AllocType->isAnyComplexType())
CGF.EmitComplexExprIntoAddr(Init, NewPtr,
AllocType.isVolatileQualified());
Modified: cfe/trunk/test/CodeGenCXX/new.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/new.cpp?rev=89613&r1=89612&r2=89613&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/new.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/new.cpp Sun Nov 22 13:25:33 2009
@@ -72,3 +72,10 @@
new U[10];
new U[n];
}
+
+void t9() {
+ bool b;
+
+ new bool(true);
+ new (&b) bool(true);
+}
More information about the cfe-commits
mailing list