summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 7f9b66468b..682d14ca2e 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -625,6 +625,12 @@ Value *ScalarExprEmitter::EmitCastExpr(const Expr *E, QualType DestTy,
switch (Kind) {
default:
+ // FIXME: Assert here.
+ // assert(0 && "Unhandled cast kind!");
+ break;
+ case CastExpr::CK_Unknown:
+ // FIXME: We should really assert here - Unknown casts should never get
+ // as far as to codegen.
break;
case CastExpr::CK_BitCast: {
Value *Src = Visit(const_cast<Expr*>(E));
@@ -685,6 +691,16 @@ Value *ScalarExprEmitter::EmitCastExpr(const Expr *E, QualType DestTy,
NullCheckValue);
}
+ case CastExpr::CK_IntegralToPointer: {
+ Value *Src = Visit(const_cast<Expr*>(E));
+ return Builder.CreateIntToPtr(Src, ConvertType(DestTy));
+ }
+
+ case CastExpr::CK_PointerToIntegral: {
+ Value *Src = Visit(const_cast<Expr*>(E));
+ return Builder.CreatePtrToInt(Src, ConvertType(DestTy));
+ }
+
}
// Handle cases where the source is an non-complex type.