зеркало из https://github.com/microsoft/clang-1.git
The FP constant evaluator was missing a few cases of unary operators that return floats
but whose operand isn't a float: specifically, __real__ and __imag__. Instead of filtering these out, just implement them. Fixes <rdar://problem/7958272>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103307 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
6ad9ac0979
Коммит
abd3a857ac
|
@ -1703,9 +1703,11 @@ public:
|
||||||
{ return Visit(E->getChosenSubExpr(Info.Ctx)); }
|
{ return Visit(E->getChosenSubExpr(Info.Ctx)); }
|
||||||
bool VisitUnaryExtension(const UnaryOperator *E)
|
bool VisitUnaryExtension(const UnaryOperator *E)
|
||||||
{ return Visit(E->getSubExpr()); }
|
{ return Visit(E->getSubExpr()); }
|
||||||
|
bool VisitUnaryReal(const UnaryOperator *E);
|
||||||
|
bool VisitUnaryImag(const UnaryOperator *E);
|
||||||
|
|
||||||
// FIXME: Missing: __real__/__imag__, array subscript of vector,
|
// FIXME: Missing: array subscript of vector, member of vector,
|
||||||
// member of vector, ImplicitValueInitExpr
|
// ImplicitValueInitExpr
|
||||||
};
|
};
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
|
@ -1791,6 +1793,22 @@ bool FloatExprEvaluator::VisitCallExpr(const CallExpr *E) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FloatExprEvaluator::VisitUnaryReal(const UnaryOperator *E) {
|
||||||
|
ComplexValue CV;
|
||||||
|
if (!EvaluateComplex(E->getSubExpr(), CV, Info))
|
||||||
|
return false;
|
||||||
|
Result = CV.FloatReal;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FloatExprEvaluator::VisitUnaryImag(const UnaryOperator *E) {
|
||||||
|
ComplexValue CV;
|
||||||
|
if (!EvaluateComplex(E->getSubExpr(), CV, Info))
|
||||||
|
return false;
|
||||||
|
Result = CV.FloatImag;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool FloatExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
|
bool FloatExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
|
||||||
if (E->getOpcode() == UnaryOperator::Deref)
|
if (E->getOpcode() == UnaryOperator::Deref)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -89,3 +89,7 @@ void t6() {
|
||||||
--ci1;
|
--ci1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// <rdar://problem/7958272>
|
||||||
|
double t7(double _Complex c) {
|
||||||
|
return __builtin_fabs(__real__(c));
|
||||||
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче