[cfe-commits] r65613 - /cfe/trunk/lib/AST/ExprConstant.cpp
Eli Friedman
eli.friedman at gmail.com
Thu Feb 26 20:45:45 PST 2009
Author: efriedma
Date: Thu Feb 26 22:45:43 2009
New Revision: 65613
URL: http://llvm.org/viewvc/llvm-project?rev=65613&view=rev
Log:
Some minor improvements to Evaluate.
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=65613&r1=65612&r2=65613&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Thu Feb 26 22:45:43 2009
@@ -636,16 +636,24 @@
return Success(0, E);
}
+ bool VisitImplicitValueInitExpr(const ImplicitValueInitExpr *E) {
+ return Success(0, E);
+ }
+
bool VisitUnaryTypeTraitExpr(const UnaryTypeTraitExpr *E) {
return Success(E->EvaluateTrait(), E);
}
+ bool VisitChooseExpr(const ChooseExpr *E);
+ bool VisitUnaryReal(const UnaryOperator *E) {
+ return Visit(E->getSubExpr());
+ }
+ bool VisitUnaryImag(const UnaryOperator *E);
+
private:
unsigned GetAlignOfExpr(const Expr *E);
unsigned GetAlignOfType(QualType T);
- // FIXME: Missing: __real__/__imag__, array subscript of vector,
- // member of vector, __builtin_choose_expr,
- // ImplicitValueInitExpr
+ // FIXME: Missing: array subscript of vector, member of vector
};
} // end anonymous namespace
@@ -1170,6 +1178,18 @@
return Success(HandleFloatToIntCast(DestType, SrcType, F, Info.Ctx), E);
}
+bool IntExprEvaluator::VisitChooseExpr(const ChooseExpr *E) {
+ Expr* EvalExpr = E->isConditionTrue(Info.Ctx) ? E->getLHS() : E->getRHS();
+
+ return Visit(EvalExpr);
+}
+
+bool IntExprEvaluator::VisitUnaryImag(const UnaryOperator *E) {
+ if (!E->getSubExpr()->isEvaluatable(Info.Ctx))
+ Info.EvalResult.HasSideEffects = true;
+ return Success(0, E);
+}
+
//===----------------------------------------------------------------------===//
// Float Evaluation
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list