summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-11-16 06:21:14 +0000
committerJohn McCall <rjmccall@apple.com>2010-11-16 06:21:14 +0000
commit3eba6e67ec0c8abc06e97852684ea66224a40981 (patch)
treebe9a1a18924c413e3ef4cc2a5ebf72734fb3515c /clang
parentd50a27111cef3335d52de9056a60b081aa57b6df (diff)
downloadbcm5719-llvm-3eba6e67ec0c8abc06e97852684ea66224a40981.tar.gz
bcm5719-llvm-3eba6e67ec0c8abc06e97852684ea66224a40981.zip
Now that we have reliable cast kinds, simplify scalar cast IR gen.
llvm-svn: 119332
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp39
1 files changed, 3 insertions, 36 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index 98676d9ff7c..a64debd6c12 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -1041,9 +1041,6 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
const CXXDynamicCastExpr *DCE = cast<CXXDynamicCastExpr>(CE);
return CGF.EmitDynamicCast(V, DCE);
}
- case CK_ToUnion:
- assert(0 && "Should be unreachable!");
- break;
case CK_ArrayToPointerDecay: {
assert(E->getType()->isArrayType() &&
@@ -1101,7 +1098,8 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
case CK_IntegralComplexToFloatingComplex:
case CK_FloatingComplexToIntegralComplex:
case CK_ConstructorConversion:
- assert(0 && "Should be unreachable!");
+ case CK_ToUnion:
+ llvm_unreachable("scalar cast to non-scalar value");
break;
case CK_IntegralToPointer: {
@@ -1190,39 +1188,8 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
}
}
-
- // Handle cases where the source is an non-complex type.
-
- if (!CGF.hasAggregateLLVMType(E->getType())) {
- Value *Src = Visit(const_cast<Expr*>(E));
-
- // Use EmitScalarConversion to perform the conversion.
- return EmitScalarConversion(Src, E->getType(), DestTy);
- }
-
- // Handle cases where the source is a complex type.
- // TODO: when we're certain about cast kinds, we should just be able
- // to assert that no complexes make it here.
- if (E->getType()->isAnyComplexType()) {
- bool IgnoreImag = true;
- bool IgnoreImagAssign = true;
- bool IgnoreReal = IgnoreResultAssign;
- bool IgnoreRealAssign = IgnoreResultAssign;
- if (DestTy->isBooleanType())
- IgnoreImagAssign = IgnoreImag = false;
- else if (DestTy->isVoidType()) {
- IgnoreReal = IgnoreImag = false;
- IgnoreRealAssign = IgnoreImagAssign = true;
- }
- CodeGenFunction::ComplexPairTy V
- = CGF.EmitComplexExpr(E, IgnoreReal, IgnoreImag, IgnoreRealAssign,
- IgnoreImagAssign);
- return EmitComplexToScalarConversion(V, E->getType(), DestTy);
- }
- // Okay, this is a cast from an aggregate. It must be a cast to void. Just
- // evaluate the result and return.
- CGF.EmitAggExpr(E, AggValueSlot::ignored(), true);
+ llvm_unreachable("unknown scalar cast");
return 0;
}
OpenPOWER on IntegriCloud