diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-09-15 04:48:33 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-09-15 04:48:33 +0000 |
| commit | 7f9e646b7ed47bc8e9a60031ad0c2b55031e2077 (patch) | |
| tree | 82b80b60e961e8fe37c5d3a425a4d5bbf9286a5c /lib/CodeGen/CGExprScalar.cpp | |
| parent | c1eb14a66fdd955aff3f957a5843295f27952bdd (diff) | |
| download | clang-7f9e646b7ed47bc8e9a60031ad0c2b55031e2077.tar.gz clang-7f9e646b7ed47bc8e9a60031ad0c2b55031e2077.tar.bz2 clang-7f9e646b7ed47bc8e9a60031ad0c2b55031e2077.tar.xz | |
Handle reinterpret_cast between integral types and pointer types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81837 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 16 |
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. |
