[cfe-commits] r121022 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/CodeGenObjC/property.m

John McCall rjmccall at apple.com
Mon Dec 6 10:36:11 PST 2010


Author: rjmccall
Date: Mon Dec  6 12:36:11 2010
New Revision: 121022

URL: http://llvm.org/viewvc/llvm-project?rev=121022&view=rev
Log:
Do unary conversions on vararg arguments and *then* special-case float.
Fixes PR8742.


Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/test/CodeGenObjC/property.m

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=121022&r1=121021&r2=121022&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Dec  6 12:36:11 2010
@@ -345,12 +345,11 @@
   QualType Ty = Expr->getType();
   assert(!Ty.isNull() && "DefaultArgumentPromotion - missing type");
 
+  UsualUnaryConversions(Expr);
+
   // If this is a 'float' (CVR qualified or typedef) promote to double.
   if (Ty->isSpecificBuiltinType(BuiltinType::Float))
-    return ImpCastExprToType(Expr, Context.DoubleTy,
-                             CK_FloatingCast);
-
-  UsualUnaryConversions(Expr);
+    return ImpCastExprToType(Expr, Context.DoubleTy, CK_FloatingCast);
 }
 
 /// DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but

Modified: cfe/trunk/test/CodeGenObjC/property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/property.m?rev=121022&r1=121021&r2=121022&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/property.m (original)
+++ cfe/trunk/test/CodeGenObjC/property.m Mon Dec  6 12:36:11 2010
@@ -89,3 +89,17 @@
   struct test3_struct array[1] = { p.s };
   struct test3_nested agg = { p.s };
 }
+
+// PR8742
+ at interface Test4  {}
+ at property float f;
+ at end
+// CHECK: define void @test4
+void test4(Test4 *t) {
+  extern int test4_printf(const char *, ...);
+  // CHECK: [[TMP:%.*]] = call float {{.*}} @objc_msgSend
+  // CHECK-NEXT: [[EXT:%.*]] = fpext float [[TMP]] to double
+  // CHECK-NEXT: call i32 (i8*, ...)* @test4_printf(i8* {{.*}}, double [[EXT]])
+  // CHECK-NEXT: ret void
+  test4_printf("%.2f", t.f);
+}





More information about the cfe-commits mailing list