[cfe-commits] r89023 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/CodeGen/conditional.c
Eli Friedman
eli.friedman at gmail.com
Mon Nov 16 17:22:06 PST 2009
Author: efriedma
Date: Mon Nov 16 19:22:05 2009
New Revision: 89023
URL: http://llvm.org/viewvc/llvm-project?rev=89023&view=rev
Log:
PR5526: Make sure to set the right cast kinds for the inserted implicit casts.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/CodeGen/conditional.c
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=89023&r1=89022&r2=89023&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Nov 16 19:22:05 2009
@@ -3584,9 +3584,9 @@
= Context.getQualifiedType(rhptee, lhptee.getQualifiers());
QualType destType = Context.getPointerType(destPointee);
// Add qualifiers if necessary.
- ImpCastExprToType(LHS, destType, CastExpr::CK_NoOp);
+ ImpCastExprToType(RHS, destType, CastExpr::CK_NoOp);
// Promote to void*.
- ImpCastExprToType(RHS, destType, CastExpr::CK_BitCast);
+ ImpCastExprToType(LHS, destType, CastExpr::CK_BitCast);
return destType;
}
Modified: cfe/trunk/test/CodeGen/conditional.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/conditional.c?rev=89023&r1=89022&r2=89023&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/conditional.c (original)
+++ cfe/trunk/test/CodeGen/conditional.c Mon Nov 16 19:22:05 2009
@@ -39,3 +39,11 @@
void _php_stream_free4() {
1 ? _efree(0) : free(0);
}
+
+// PR5526
+struct test9 { int a; };
+void* test9spare();
+void test9(struct test9 *p) {
+ p ? p : test9spare();
+}
+
More information about the cfe-commits
mailing list