[cfe-commits] r60296 - /cfe/trunk/lib/AST/ExprConstant.cpp

Anders Carlsson andersca at mac.com
Sun Nov 30 08:38:37 PST 2008


Author: andersca
Date: Sun Nov 30 10:38:33 2008
New Revision: 60296

URL: http://llvm.org/viewvc/llvm-project?rev=60296&view=rev
Log:
EvalInfo now holds a reference to an EvalResult struct.

Modified:
    cfe/trunk/lib/AST/ExprConstant.cpp

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

==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Sun Nov 30 10:38:33 2008
@@ -39,27 +39,15 @@
 struct EvalInfo {
   ASTContext &Ctx;
   
+  /// EvalResult - Contains information about the evaluation.
+  Expr::EvalResult &EvalResult;
+  
   /// isEvaluated - True if the subexpression is required to be evaluated, false
   /// if it is short-circuited (according to C rules).
   bool isEvaluated;
-  
-  /// ICEDiag - If the expression is unfoldable, then ICEDiag contains the 
-  /// error diagnostic indicating why it is not foldable and DiagLoc indicates a
-  /// caret position for the error.  If it is foldable, but the expression is
-  /// not an integer constant expression, ICEDiag contains the extension
-  /// diagnostic to emit which describes why it isn't an integer constant
-  /// expression.  If this expression *is* an integer-constant-expr, then
-  /// ICEDiag is zero.
-  ///
-  /// The caller can choose to emit this diagnostic or not, depending on whether
-  /// they require an i-c-e or a constant or not.  DiagLoc indicates the caret
-  /// position for the report.
-  ///
-  /// If ICEDiag is zero, then this expression is an i-c-e.  
-  unsigned ICEDiag;
-  SourceLocation DiagLoc;
 
-  EvalInfo(ASTContext &ctx) : Ctx(ctx), isEvaluated(true), ICEDiag(0) {}
+  EvalInfo(ASTContext &ctx, Expr::EvalResult& evalresult) : Ctx(ctx), 
+           EvalResult(evalresult), isEvaluated(true) {}
 };
 
 
@@ -342,8 +330,8 @@
   }
   
   bool Extension(SourceLocation L, diag::kind D) {
-    Info.DiagLoc = L;
-    Info.ICEDiag = D;
+    Info.EvalResult.DiagLoc = L;
+    Info.EvalResult.Diag = D;
     return true;  // still a constant.
   }
     
@@ -359,9 +347,9 @@
     }
     
     // Take the first error.
-    if (Info.ICEDiag == 0) {
-      Info.DiagLoc = L;
-      Info.ICEDiag = D;
+    if (Info.EvalResult.Diag == 0) {
+      Info.EvalResult.DiagLoc = L;
+      Info.EvalResult.Diag = D;
     }
     return false;
   }
@@ -1164,7 +1152,9 @@
 /// we want to.  If this function returns true, it returns the folded constant
 /// in Result.
 bool Expr::Evaluate(APValue &Result, ASTContext &Ctx, bool *isEvaluated) const {
-  EvalInfo Info(Ctx);
+  Expr::EvalResult EvalResult;
+  EvalInfo Info(Ctx, EvalResult);
+
   if (getType()->isIntegerType()) {
     llvm::APSInt sInt(32);
     if (!EvaluateInteger(this, sInt, Info))





More information about the cfe-commits mailing list