[cfe-commits] r70090 - in /cfe/trunk: lib/AST/Expr.cpp test/Sema/i-c-e.c

Eli Friedman eli.friedman at gmail.com
Sat Apr 25 15:37:12 PDT 2009


Author: efriedma
Date: Sat Apr 25 17:37:12 2009
New Revision: 70090

URL: http://llvm.org/viewvc/llvm-project?rev=70090&view=rev
Log:
Change isNullPointerConstant to be strict; hopefully this won't cause 
any issues now that we have our own tgmath.h.


Modified:
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/test/Sema/i-c-e.c

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

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Sat Apr 25 17:37:12 2009
@@ -1374,12 +1374,8 @@
   
   // If we have an integer constant expression, we need to *evaluate* it and
   // test for the value 0.
-  // FIXME: We should probably return false if we're compiling in strict mode
-  // and Diag is not null (this indicates that the value was foldable but not
-  // an ICE.
-  EvalResult Result;
-  return Evaluate(Result, Ctx) && !Result.HasSideEffects &&
-        Result.Val.isInt() && Result.Val.getInt() == 0;
+  llvm::APSInt Result;
+  return isIntegerConstantExpr(Result, Ctx) && Result == 0;
 }
 
 /// isBitField - Return true if this expression is a bit-field.

Modified: cfe/trunk/test/Sema/i-c-e.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/i-c-e.c?rev=70090&r1=70089&r2=70090&view=diff

==============================================================================
--- cfe/trunk/test/Sema/i-c-e.c (original)
+++ cfe/trunk/test/Sema/i-c-e.c Sat Apr 25 17:37:12 2009
@@ -3,7 +3,7 @@
 #include <stdint.h>
 #include <limits.h>
 
-int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;}
+int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;} // expected-error {{incomplete type 'void' is not assignable}}
 
 // rdar://6091492 - ?: with __builtin_constant_p as the operand is an i-c-e.
 int expr;





More information about the cfe-commits mailing list