[cfe-commits] r51193 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp test/CodeGen/conditional.c
Eli Friedman
eli.friedman at gmail.com
Fri May 16 10:37:12 PDT 2008
Author: efriedma
Date: Fri May 16 12:37:11 2008
New Revision: 51193
URL: http://llvm.org/viewvc/llvm-project?rev=51193&view=rev
Log:
Patch for PR2334, and a similar ObjC bug.
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/test/CodeGen/conditional.c
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=51193&r1=51192&r2=51193&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri May 16 12:37:11 2008
@@ -1050,7 +1050,8 @@
// Handle the GNU extension for missing LHS.
Value *LHS;
if (E->getLHS())
- LHS = Visit(E->getLHS());
+ LHS = EmitScalarConversion(Visit(E->getLHS()), E->getLHS()->getType(),
+ E->getType());
else // Perform promotions, to handle cases like "short ?: int"
LHS = EmitScalarConversion(CondVal, E->getCond()->getType(), E->getType());
@@ -1059,7 +1060,8 @@
CGF.EmitBlock(RHSBlock);
- Value *RHS = Visit(E->getRHS());
+ Value *RHS = EmitScalarConversion(Visit(E->getRHS()), E->getRHS()->getType(),
+ E->getType());
Builder.CreateBr(ContBlock);
RHSBlock = Builder.GetInsertBlock();
Modified: cfe/trunk/test/CodeGen/conditional.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/conditional.c?rev=51193&r1=51192&r2=51193&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/conditional.c (original)
+++ cfe/trunk/test/CodeGen/conditional.c Fri May 16 12:37:11 2008
@@ -25,3 +25,8 @@
void* vp;
cip = 0 ? vp : cip;
}
+
+void test6();
+void test7(int);
+void* test8() {return 1 ? test6 : test7;}
+
More information about the cfe-commits
mailing list