[cfe-commits] r39610 - /cfe/cfe/trunk/AST/Expr.cpp

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


Author: clattner
Date: Wed Jul 11 11:46:13 2007
New Revision: 39610

URL: http://llvm.org/viewvc/llvm-project?rev=39610&view=rev
Log:
implement a fixme, fixing test/Sema/i-c-e1.c

Modified:
    cfe/cfe/trunk/AST/Expr.cpp

Modified: cfe/cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Expr.cpp?rev=39610&r1=39609&r2=39610&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Expr.cpp (original)
+++ cfe/cfe/trunk/AST/Expr.cpp Wed Jul 11 11:46:13 2007
@@ -463,15 +463,8 @@
   if (!getType()->isIntegerType())
     return false;
   
-  // FIXME: If we have an integer constant expression, we need
-  // to *evaluate* it and test for the value 0. The current code is too 
-  // simplistic...it only allows for the integer literal "0". 
-  // For example, the following is valid code:
-  //
-  //  void test1() { *(n ? p : (void *)(7-7)) = 1; }
-  //
-  /// FIXME: Just call isIntegerConstantExpr now.
-  if (const IntegerLiteral *C = dyn_cast<IntegerLiteral>(this))
-    return C->getValue() == 0;
-  return false;
+  // If we have an integer constant expression, we need to *evaluate* it and
+  // test for the value 0.
+  APSInt Val(32);
+  return isIntegerConstantExpr(Val, 0, true) && Val == 0;
 }





More information about the cfe-commits mailing list