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

clattner at cs.uiuc.edu clattner at cs.uiuc.edu
Wed Jul 11 09:46:19 PDT 2007


Author: clattner
Date: Wed Jul 11 11:46:19 2007
New Revision: 39620

URL: http://llvm.org/viewvc/llvm-project?rev=39620&view=rev
Log:
factor casts together, add a case for __extension__

Modified:
    cfe/cfe/trunk/Sema/SemaExpr.cpp

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

==============================================================================
--- cfe/cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/cfe/trunk/Sema/SemaExpr.cpp Wed Jul 11 11:46:19 2007
@@ -1220,7 +1220,8 @@
 
 // Unary Operators.  'Tok' is the token for the operator.
 Action::ExprResult Sema::ParseUnaryOp(SourceLocation OpLoc, tok::TokenKind Op,
-                                      ExprTy *Input) {
+                                      ExprTy *input) {
+  Expr *Input = (Expr*)input;
   UnaryOperator::Opcode Opc = ConvertTokenKindToUnaryOpcode(Op);
   QualType resultType;
   switch (Opc) {
@@ -1228,30 +1229,30 @@
     assert(0 && "Unimplemented unary expr!");
   case UnaryOperator::PreInc:
   case UnaryOperator::PreDec:
-    resultType = CheckIncrementDecrementOperand((Expr *)Input, OpLoc);
+    resultType = CheckIncrementDecrementOperand(Input, OpLoc);
     break;
   case UnaryOperator::AddrOf: 
-    resultType = CheckAddressOfOperand((Expr *)Input, OpLoc);
+    resultType = CheckAddressOfOperand(Input, OpLoc);
     break;
   case UnaryOperator::Deref: 
-    resultType = CheckIndirectionOperand((Expr *)Input, OpLoc);
+    resultType = CheckIndirectionOperand(Input, OpLoc);
     break;
   case UnaryOperator::Plus:
   case UnaryOperator::Minus:
-    resultType = UsualUnaryConversions(((Expr *)Input)->getType());
+    resultType = UsualUnaryConversions(Input->getType());
     if (!resultType->isArithmeticType())  // C99 6.5.3.3p1
       return Diag(OpLoc, diag::err_typecheck_unary_expr, 
                   resultType.getAsString());
     break;
   case UnaryOperator::Not: // bitwise complement
-    resultType = UsualUnaryConversions(((Expr *)Input)->getType());
+    resultType = UsualUnaryConversions(Input->getType());
     if (!resultType->isIntegerType())  // C99 6.5.3.3p1
       return Diag(OpLoc, diag::err_typecheck_unary_expr,
                   resultType.getAsString());
     break;
   case UnaryOperator::LNot: // logical negation
     // Unlike +/-/~, integer promotions aren't done here (C99 6.5.3.3p5).
-    resultType = DefaultFunctionArrayConversion(((Expr *)Input)->getType());
+    resultType = DefaultFunctionArrayConversion(Input->getType());
     if (!resultType->isScalarType()) // C99 6.5.3.3p1
       return Diag(OpLoc, diag::err_typecheck_unary_expr,
                   resultType.getAsString());
@@ -1259,17 +1260,19 @@
     resultType = Context.IntTy;
     break;
   case UnaryOperator::SizeOf:
-    resultType = CheckSizeOfAlignOfOperand(((Expr *)Input)->getType(), OpLoc,
-                                           true);
+    resultType = CheckSizeOfAlignOfOperand(Input->getType(), OpLoc, true);
     break;
   case UnaryOperator::AlignOf:
-    resultType = CheckSizeOfAlignOfOperand(((Expr *)Input)->getType(), OpLoc,
-                                           false);
+    resultType = CheckSizeOfAlignOfOperand(Input->getType(), OpLoc, false);
+    break;
+  case UnaryOperator::Extension:
+    // FIXME: does __extension__ cause any promotions? I would think not.
+    resultType = Input->getType();
     break;
   }
   if (resultType.isNull())
     return true;
-  return new UnaryOperator((Expr *)Input, Opc, resultType, OpLoc);
+  return new UnaryOperator(Input, Opc, resultType, OpLoc);
 }
 
 /// ParseAddrLabel - Parse the GNU address of label extension: "&&foo".





More information about the cfe-commits mailing list