зеркало из https://github.com/microsoft/clang-1.git
Minor Evaluate cleanup; add some boilerplate implementations to
Evaluate for __extension__ and __builtin_choose_expr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67506 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
a1f47c447a
Коммит
ba98d6bb41
|
@ -163,7 +163,11 @@ public:
|
||||||
APValue VisitObjCEncodeExpr(ObjCEncodeExpr *E) { return APValue(E, 0); }
|
APValue VisitObjCEncodeExpr(ObjCEncodeExpr *E) { return APValue(E, 0); }
|
||||||
APValue VisitArraySubscriptExpr(ArraySubscriptExpr *E);
|
APValue VisitArraySubscriptExpr(ArraySubscriptExpr *E);
|
||||||
APValue VisitUnaryDeref(UnaryOperator *E);
|
APValue VisitUnaryDeref(UnaryOperator *E);
|
||||||
// FIXME: Missing: __extension__, __real__, __imag__, __builtin_choose_expr
|
APValue VisitUnaryExtension(const UnaryOperator *E)
|
||||||
|
{ return Visit(E->getSubExpr()); }
|
||||||
|
APValue VisitChooseExpr(const ChooseExpr *E)
|
||||||
|
{ return Visit(E->getChosenSubExpr(Info.Ctx)); }
|
||||||
|
// FIXME: Missing: __real__, __imag__
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
@ -285,8 +289,9 @@ public:
|
||||||
APValue VisitImplicitValueInitExpr(ImplicitValueInitExpr *E)
|
APValue VisitImplicitValueInitExpr(ImplicitValueInitExpr *E)
|
||||||
{ return APValue((Expr*)0, 0); }
|
{ return APValue((Expr*)0, 0); }
|
||||||
APValue VisitConditionalOperator(ConditionalOperator *E);
|
APValue VisitConditionalOperator(ConditionalOperator *E);
|
||||||
APValue VisitChooseExpr(ChooseExpr *E);
|
APValue VisitChooseExpr(ChooseExpr *E)
|
||||||
// FIXME: Missing: @encode, @protocol, @selector
|
{ return Visit(E->getChosenSubExpr(Info.Ctx)); }
|
||||||
|
// FIXME: Missing: @protocol, @selector
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
@ -375,7 +380,6 @@ APValue PointerExprEvaluator::VisitCastExpr(const CastExpr* E) {
|
||||||
return APValue();
|
return APValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
//assert(0 && "Unhandled cast");
|
|
||||||
return APValue();
|
return APValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,13 +403,6 @@ APValue PointerExprEvaluator::VisitConditionalOperator(ConditionalOperator *E) {
|
||||||
return APValue();
|
return APValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
APValue PointerExprEvaluator::VisitChooseExpr(ChooseExpr *E) {
|
|
||||||
APValue Result;
|
|
||||||
if (EvaluatePointer(E->getChosenSubExpr(Info.Ctx), Result, Info))
|
|
||||||
return Result;
|
|
||||||
return APValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Vector Evaluation
|
// Vector Evaluation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -437,7 +434,8 @@ namespace {
|
||||||
APValue VisitCompoundLiteralExpr(const CompoundLiteralExpr *E);
|
APValue VisitCompoundLiteralExpr(const CompoundLiteralExpr *E);
|
||||||
APValue VisitInitListExpr(const InitListExpr *E);
|
APValue VisitInitListExpr(const InitListExpr *E);
|
||||||
APValue VisitConditionalOperator(const ConditionalOperator *E);
|
APValue VisitConditionalOperator(const ConditionalOperator *E);
|
||||||
APValue VisitChooseExpr(const ChooseExpr *E);
|
APValue VisitChooseExpr(const ChooseExpr *E)
|
||||||
|
{ return Visit(E->getChosenSubExpr(Info.Ctx)); }
|
||||||
APValue VisitUnaryImag(const UnaryOperator *E);
|
APValue VisitUnaryImag(const UnaryOperator *E);
|
||||||
// FIXME: Missing: unary -, unary ~, binary add/sub/mul/div,
|
// FIXME: Missing: unary -, unary ~, binary add/sub/mul/div,
|
||||||
// binary comparisons, binary and/or/xor,
|
// binary comparisons, binary and/or/xor,
|
||||||
|
@ -530,13 +528,6 @@ APValue VectorExprEvaluator::VisitConditionalOperator(const ConditionalOperator
|
||||||
return APValue();
|
return APValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
APValue VectorExprEvaluator::VisitChooseExpr(const ChooseExpr *E) {
|
|
||||||
APValue Result;
|
|
||||||
if (EvaluateVector(E->getChosenSubExpr(Info.Ctx), Result, Info))
|
|
||||||
return Result;
|
|
||||||
return APValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
APValue VectorExprEvaluator::VisitUnaryImag(const UnaryOperator *E) {
|
APValue VectorExprEvaluator::VisitUnaryImag(const UnaryOperator *E) {
|
||||||
if (!E->getSubExpr()->isEvaluatable(Info.Ctx))
|
if (!E->getSubExpr()->isEvaluatable(Info.Ctx))
|
||||||
Info.EvalResult.HasSideEffects = true;
|
Info.EvalResult.HasSideEffects = true;
|
||||||
|
@ -651,7 +642,10 @@ public:
|
||||||
return Success(E->EvaluateTrait(), E);
|
return Success(E->EvaluateTrait(), E);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VisitChooseExpr(const ChooseExpr *E);
|
bool VisitChooseExpr(const ChooseExpr *E) {
|
||||||
|
return Visit(E->getChosenSubExpr(Info.Ctx));
|
||||||
|
}
|
||||||
|
|
||||||
bool VisitUnaryReal(const UnaryOperator *E);
|
bool VisitUnaryReal(const UnaryOperator *E);
|
||||||
bool VisitUnaryImag(const UnaryOperator *E);
|
bool VisitUnaryImag(const UnaryOperator *E);
|
||||||
|
|
||||||
|
@ -1193,10 +1187,6 @@ bool IntExprEvaluator::VisitCastExpr(CastExpr *E) {
|
||||||
return Success(HandleFloatToIntCast(DestType, SrcType, F, Info.Ctx), E);
|
return Success(HandleFloatToIntCast(DestType, SrcType, F, Info.Ctx), E);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IntExprEvaluator::VisitChooseExpr(const ChooseExpr *E) {
|
|
||||||
return Visit(E->getChosenSubExpr(Info.Ctx));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IntExprEvaluator::VisitUnaryReal(const UnaryOperator *E) {
|
bool IntExprEvaluator::VisitUnaryReal(const UnaryOperator *E) {
|
||||||
if (E->getSubExpr()->getType()->isAnyComplexType()) {
|
if (E->getSubExpr()->getType()->isAnyComplexType()) {
|
||||||
APValue LV;
|
APValue LV;
|
||||||
|
@ -1247,9 +1237,13 @@ public:
|
||||||
bool VisitCastExpr(CastExpr *E);
|
bool VisitCastExpr(CastExpr *E);
|
||||||
bool VisitCXXZeroInitValueExpr(CXXZeroInitValueExpr *E);
|
bool VisitCXXZeroInitValueExpr(CXXZeroInitValueExpr *E);
|
||||||
|
|
||||||
// FIXME: Missing: __real__/__imag__, __extension__,
|
bool VisitChooseExpr(const ChooseExpr *E)
|
||||||
// array subscript of vector, member of vector,
|
{ return Visit(E->getChosenSubExpr(Info.Ctx)); }
|
||||||
// __builtin_choose_expr, ImplicitValueInitExpr,
|
bool VisitUnaryExtension(const UnaryOperator *E)
|
||||||
|
{ return Visit(E->getSubExpr()); }
|
||||||
|
|
||||||
|
// FIXME: Missing: __real__/__imag__, array subscript of vector,
|
||||||
|
// member of vector, ImplicitValueInitExpr,
|
||||||
// conditional ?:, comma
|
// conditional ?:, comma
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
@ -1510,8 +1504,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
APValue VisitBinaryOperator(const BinaryOperator *E);
|
APValue VisitBinaryOperator(const BinaryOperator *E);
|
||||||
// FIXME Missing: unary +/-/~, __extension__, binary div,
|
APValue VisitChooseExpr(const ChooseExpr *E)
|
||||||
// __builtin_choose_expr, ImplicitValueInitExpr,
|
{ return Visit(E->getChosenSubExpr(Info.Ctx)); }
|
||||||
|
APValue VisitUnaryExtension(const UnaryOperator *E)
|
||||||
|
{ return Visit(E->getSubExpr()); }
|
||||||
|
// FIXME Missing: unary +/-/~, binary div, ImplicitValueInitExpr,
|
||||||
// conditional ?:, comma
|
// conditional ?:, comma
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
Загрузка…
Ссылка в новой задаче