forked from OSchip/llvm-project
Add support for init lists for complex variables.
llvm-svn: 51080
This commit is contained in:
parent
20a44ed730
commit
dd7406e65c
|
@ -177,6 +177,8 @@ public:
|
|||
|
||||
ComplexPairTy VisitConditionalOperator(const ConditionalOperator *CO);
|
||||
ComplexPairTy VisitChooseExpr(ChooseExpr *CE);
|
||||
|
||||
ComplexPairTy VisitInitListExpr(InitListExpr *E);
|
||||
};
|
||||
} // end anonymous namespace.
|
||||
|
||||
|
@ -500,6 +502,17 @@ ComplexPairTy ComplexExprEmitter::VisitChooseExpr(ChooseExpr *E) {
|
|||
return Visit(E->isConditionTrue(CGF.getContext()) ? E->getLHS() :E->getRHS());
|
||||
}
|
||||
|
||||
ComplexPairTy ComplexExprEmitter::VisitInitListExpr(InitListExpr *E) {
|
||||
if (E->getNumInits())
|
||||
return Visit(E->getInit(0));
|
||||
|
||||
// Empty init list intializes to null
|
||||
QualType Ty = E->getType()->getAsComplexType()->getElementType();
|
||||
const llvm::Type* LTy = CGF.ConvertType(Ty);
|
||||
llvm::Value* zeroConstant = llvm::Constant::getNullValue(LTy);
|
||||
return ComplexPairTy(zeroConstant, zeroConstant);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Entry Point into this File
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue