[cfe-commits] r46489 - /cfe/trunk/Sema/SemaExpr.cpp

Steve Naroff snaroff at apple.com
Mon Jan 28 18:42:23 PST 2008


Author: snaroff
Date: Mon Jan 28 20:42:22 2008
New Revision: 46489

URL: http://llvm.org/viewvc/llvm-project?rev=46489&view=rev
Log:

Tweak Sema::DefaultArgumentPromotion() to call UsualUnaryConversions(). This makes sure function calls that don't have a prototype get the default function/array conversion.

Patch by Eli Friedman!


Modified:
    cfe/trunk/Sema/SemaExpr.cpp

Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=46489&r1=46488&r2=46489&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Mon Jan 28 20:42:22 2008
@@ -866,16 +866,16 @@
 }
 
 /// DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
-/// do not have a prototype. Integer promotions are performed on each 
-/// argument, and arguments that have type float are promoted to double.
+/// do not have a prototype. Arguments that have type float are promoted to 
+/// double. All other argument types are converted by UsualUnaryConversions().
 void Sema::DefaultArgumentPromotion(Expr *&Expr) {
   QualType Ty = Expr->getType();
   assert(!Ty.isNull() && "DefaultArgumentPromotion - missing type");
 
-  if (Ty->isPromotableIntegerType()) // C99 6.3.1.1p2
-    ImpCastExprToType(Expr, Context.IntTy);
   if (Ty == Context.FloatTy)
     ImpCastExprToType(Expr, Context.DoubleTy);
+  else
+    UsualUnaryConversions(Expr);
 }
 
 /// DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).





More information about the cfe-commits mailing list