else if (hasAggregateLLVMType(E->getType()))
// Struct return.
return RValue::getAggregate(Args[0]);
+ else {
+ // void return.
+ assert(E->getType()->isVoidType() && "Should only have a void expr here");
+ V = 0;
+ }
return RValue::get(V);
}
CGF.EmitBlock(ContBlock);
+ if (!LHS) {
+ assert(E->getType()->isVoidType() && "Non-void value should have a value");
+ return 0;
+ }
+
// Create a PHI node for the real part.
llvm::PHINode *PN = Builder.CreatePHI(LHS->getType(), "cond");
PN->reserveOperandSpace(2);
Visit(E->isConditionTrue(CGF.getContext()) ? E->getLHS() : E->getRHS());
}
-Value *ScalarExprEmitter::VisitVAArgExpr(VAArgExpr *VE)
-{
+Value *ScalarExprEmitter::VisitVAArgExpr(VAArgExpr *VE) {
llvm::Value *ArgValue = EmitLValue(VE->getSubExpr()).getAddress();
llvm::Value *V = Builder.CreateVAArg(ArgValue, ConvertType(VE->getType()));
return V;
}
-Value *ScalarExprEmitter::VisitObjCEncodeExpr(const ObjCEncodeExpr *E)
-{
+Value *ScalarExprEmitter::VisitObjCEncodeExpr(const ObjCEncodeExpr *E) {
std::string str;
CGF.getContext().getObjcEncodingForType(E->getEncodedType(), str);