summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-11-30 16:38:33 +0000
committerAnders Carlsson <andersca@mac.com>2008-11-30 16:38:33 +0000
commitbd1df8e866d88d6a683a3ee90af5911119418d87 (patch)
treeb9b0ecce1cd0b6c4601e74fb67364d844024ded3 /clang/lib/AST
parent6c5887ce16ad5840c463fc8761b5638d424f8a54 (diff)
downloadbcm5719-llvm-bd1df8e866d88d6a683a3ee90af5911119418d87.tar.gz
bcm5719-llvm-bd1df8e866d88d6a683a3ee90af5911119418d87.zip
EvalInfo now holds a reference to an EvalResult struct.
llvm-svn: 60296
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ExprConstant.cpp38
1 files changed, 14 insertions, 24 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 3efa52b260d..2b7a6468860 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -39,27 +39,15 @@ using llvm::APFloat;
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 @@ public:
}
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 @@ public:
}
// 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 @@ APValue ComplexFloatExprEvaluator::VisitBinaryOperator(const BinaryOperator *E)
/// 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))
OpenPOWER on IntegriCloud