[cfe-commits] r86738 - in /cfe/trunk: lib/CodeGen/CGCXXExpr.cpp test/CodeGenCXX/new-operator-phi.cpp
Eli Friedman
eli.friedman at gmail.com
Tue Nov 10 14:39:09 PST 2009
Author: efriedma
Date: Tue Nov 10 16:39:09 2009
New Revision: 86738
URL: http://llvm.org/viewvc/llvm-project?rev=86738&view=rev
Log:
Fix for PR5454: make sure to use the right block as the predecessor in the
generated PHI node for the null check of a new operator.
Added:
cfe/trunk/test/CodeGenCXX/new-operator-phi.cpp
Modified:
cfe/trunk/lib/CodeGen/CGCXXExpr.cpp
Modified: cfe/trunk/lib/CodeGen/CGCXXExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXXExpr.cpp?rev=86738&r1=86737&r2=86738&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXXExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXXExpr.cpp Tue Nov 10 16:39:09 2009
@@ -218,6 +218,7 @@
if (NullCheckResult) {
Builder.CreateBr(NewEnd);
+ NewNotNull = Builder.GetInsertBlock();
EmitBlock(NewNull);
Builder.CreateBr(NewEnd);
EmitBlock(NewEnd);
Added: cfe/trunk/test/CodeGenCXX/new-operator-phi.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/new-operator-phi.cpp?rev=86738&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/new-operator-phi.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/new-operator-phi.cpp Tue Nov 10 16:39:09 2009
@@ -0,0 +1,10 @@
+// RUN: clang-cc -emit-llvm-only -verify %s
+// PR5454
+
+class X {static void * operator new(unsigned size) throw(); X(int); };
+int a(), b();
+void b(int x)
+{
+ new X(x ? a() : b());
+}
+
More information about the cfe-commits
mailing list