зеркало из https://github.com/microsoft/clang-1.git
implement __extension__ and unary~ for complex.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41249 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
4ce854736d
Коммит
e98a11c704
|
@ -78,6 +78,12 @@ public:
|
|||
return Visit(E->getSubExpr());
|
||||
}
|
||||
ComplexPairTy VisitUnaryMinus (const UnaryOperator *E);
|
||||
ComplexPairTy VisitUnaryNot (const UnaryOperator *E);
|
||||
// LNot,SizeOf,AlignOf,Real,Imag never return complex.
|
||||
ComplexPairTy VisitUnaryExtension(const UnaryOperator *E) {
|
||||
return Visit(E->getSubExpr());
|
||||
}
|
||||
|
||||
// case Expr::ImplicitCastExprClass:
|
||||
// case Expr::CastExprClass:
|
||||
// case Expr::CallExprClass:
|
||||
|
@ -153,6 +159,12 @@ ComplexPairTy ComplexExprEmitter::VisitUnaryMinus(const UnaryOperator *E) {
|
|||
return ComplexPairTy(ResR, ResI);
|
||||
}
|
||||
|
||||
ComplexPairTy ComplexExprEmitter::VisitUnaryNot(const UnaryOperator *E) {
|
||||
// ~(a+ib) = a + i*-b
|
||||
ComplexPairTy Op = Visit(E->getSubExpr());
|
||||
llvm::Value *ResI = Builder.CreateNeg(Op.second, "conj.i");
|
||||
return ComplexPairTy(Op.first, ResI);
|
||||
}
|
||||
|
||||
ComplexPairTy ComplexExprEmitter::VisitBinAdd(const BinaryOperator *E) {
|
||||
ComplexPairTy LHS = Visit(E->getLHS());
|
||||
|
|
Загрузка…
Ссылка в новой задаче