From: Chris Lattner Date: Fri, 24 Aug 2007 00:01:20 +0000 (+0000) Subject: stub out complex -> bool conversion. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4f5d414b61629a30f6e956deab5cb675af4cdc16;p=clang stub out complex -> bool conversion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41347 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/CodeGen/CGExpr.cpp b/CodeGen/CGExpr.cpp index 64067e79ee..508b2833cd 100644 --- a/CodeGen/CGExpr.cpp +++ b/CodeGen/CGExpr.cpp @@ -37,7 +37,7 @@ llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(const llvm::Type *Ty, /// EvaluateExprAsBool - Perform the usual unary conversions on the specified /// expression and compare the result against zero, returning an Int1Ty value. llvm::Value *CodeGenFunction::EvaluateExprAsBool(const Expr *E) { - return ConvertScalarValueToBool(EmitExpr(E), E->getType()); + return ConvertScalarValueToBool(EmitAnyExpr(E), E->getType()); } //===--------------------------------------------------------------------===// @@ -160,12 +160,15 @@ llvm::Value *CodeGenFunction::ConvertScalarValueToBool(RValue Val, QualType Ty){ return Result; } } - } else if (isa(Ty) || - cast(Ty)->getDecl()->getKind() == Decl::Enum) { - // Code below handles this fine. + } else if (isa(Ty)) { + assert(0 && "implement complex -> bool"); + } else { - assert(isa(Ty) && "Unknwon type!"); - assert(0 && "FIXME: comparisons against complex not implemented yet"); + assert((isa(Ty) || + (isa(Ty) && + cast(Ty)->getDecl()->getKind() == Decl::Enum)) && + "Unknown Type"); + // Code below handles this case fine. } // Usual case for integers, pointers, and enums: compare against zero. @@ -642,7 +645,7 @@ RValue CodeGenFunction::EmitArraySubscriptExprRV(const ArraySubscriptExpr *E) { // have to handle a more broad range of conversions than explicit casts, as they // handle things like function to ptr-to-function decay etc. RValue CodeGenFunction::EmitCastExpr(const Expr *Op, QualType DestTy) { - RValue Src = EmitExpr(Op); + RValue Src = EmitAnyExpr(Op); // If the destination is void, just evaluate the source. if (DestTy->isVoidType())