зеркало из https://github.com/microsoft/clang-1.git
Fix for PR5447: teach Evaluate to deal with floating-point conditionals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90521 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
c71a5234c0
Коммит
67f85fcdab
|
@ -1515,6 +1515,7 @@ public:
|
|||
bool VisitFloatingLiteral(const FloatingLiteral *E);
|
||||
bool VisitCastExpr(CastExpr *E);
|
||||
bool VisitCXXZeroInitValueExpr(CXXZeroInitValueExpr *E);
|
||||
bool VisitConditionalOperator(ConditionalOperator *E);
|
||||
|
||||
bool VisitChooseExpr(const ChooseExpr *E)
|
||||
{ return Visit(E->getChosenSubExpr(Info.Ctx)); }
|
||||
|
@ -1522,8 +1523,7 @@ public:
|
|||
{ return Visit(E->getSubExpr()); }
|
||||
|
||||
// FIXME: Missing: __real__/__imag__, array subscript of vector,
|
||||
// member of vector, ImplicitValueInitExpr,
|
||||
// conditional ?:
|
||||
// member of vector, ImplicitValueInitExpr
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
|
@ -1682,6 +1682,14 @@ bool FloatExprEvaluator::VisitCXXZeroInitValueExpr(CXXZeroInitValueExpr *E) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool FloatExprEvaluator::VisitConditionalOperator(ConditionalOperator *E) {
|
||||
bool Cond;
|
||||
if (!HandleConversionToBool(E->getCond(), Cond, Info))
|
||||
return false;
|
||||
|
||||
return Visit(Cond ? E->getTrueExpr() : E->getFalseExpr());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Complex Evaluation (for float and integer)
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -126,3 +126,7 @@ uintptr_t ptrasintadd3 = 4 + (uintptr_t)&a;
|
|||
|
||||
// PR4285
|
||||
const wchar_t widestr[] = L"asdf";
|
||||
|
||||
// PR5447
|
||||
const double pr5447 = (0.05 < -1.0) ? -1.0 : 0.0499878;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче