[llvm] r235543 - [Kaleidoscope] Fix incorrect use of reinterpret_cast.
Lang Hames
lhames at gmail.com
Wed Apr 22 13:58:35 PDT 2015
Author: lhames
Date: Wed Apr 22 15:58:34 2015
New Revision: 235543
URL: http://llvm.org/viewvc/llvm-project?rev=235543&view=rev
Log:
[Kaleidoscope] Fix incorrect use of reinterpret_cast.
Thanks to Dave Blaikie for catching this.
Modified:
llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp
llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp
llvm/trunk/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp
llvm/trunk/examples/Kaleidoscope/MCJIT/cached/toy.cpp
llvm/trunk/examples/Kaleidoscope/MCJIT/complete/toy.cpp
llvm/trunk/examples/Kaleidoscope/MCJIT/initial/toy.cpp
llvm/trunk/examples/Kaleidoscope/MCJIT/lazy/toy.cpp
Modified: llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp?rev=235543&r1=235542&r2=235543&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp Wed Apr 22 15:58:34 2015
@@ -716,7 +716,7 @@ Value *BinaryExprAST::Codegen() {
// This assume we're building without RTTI because LLVM builds that way by
// default. If you build LLVM with RTTI this can be changed to a
// dynamic_cast for automatic error checking.
- VariableExprAST *LHSE = reinterpret_cast<VariableExprAST *>(LHS);
+ VariableExprAST *LHSE = static_cast<VariableExprAST *>(LHS);
if (!LHSE)
return ErrorV("destination of '=' must be a variable");
// Codegen the RHS.
Modified: llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp?rev=235543&r1=235542&r2=235543&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp Wed Apr 22 15:58:34 2015
@@ -911,7 +911,7 @@ Value *BinaryExprAST::Codegen() {
// This assume we're building without RTTI because LLVM builds that way by
// default. If you build LLVM with RTTI this can be changed to a
// dynamic_cast for automatic error checking.
- VariableExprAST *LHSE = reinterpret_cast<VariableExprAST *>(LHS);
+ VariableExprAST *LHSE = static_cast<VariableExprAST *>(LHS);
if (!LHSE)
return ErrorV("destination of '=' must be a variable");
// Codegen the RHS.
Modified: llvm/trunk/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp?rev=235543&r1=235542&r2=235543&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp Wed Apr 22 15:58:34 2015
@@ -672,7 +672,7 @@ Value *BinaryExprAST::Codegen() {
// For now, I'm building without RTTI because LLVM builds that way by
// default and so we need to build that way to use the command line supprt.
// If you build LLVM with RTTI this can be changed back to a dynamic_cast.
- VariableExprAST *LHSE = reinterpret_cast<VariableExprAST*>(LHS);
+ VariableExprAST *LHSE = static_cast<VariableExprAST*>(LHS);
if (!LHSE)
return ErrorV("destination of '=' must be a variable");
// Codegen the RHS.
Modified: llvm/trunk/examples/Kaleidoscope/MCJIT/cached/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/MCJIT/cached/toy.cpp?rev=235543&r1=235542&r2=235543&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/MCJIT/cached/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/MCJIT/cached/toy.cpp Wed Apr 22 15:58:34 2015
@@ -1039,7 +1039,7 @@ Value *BinaryExprAST::Codegen() {
// Special case '=' because we don't want to emit the LHS as an expression.
if (Op == '=') {
// Assignment requires the LHS to be an identifier.
- VariableExprAST *LHSE = reinterpret_cast<VariableExprAST*>(LHS);
+ VariableExprAST *LHSE = static_cast<VariableExprAST*>(LHS);
if (!LHSE)
return ErrorV("destination of '=' must be a variable");
// Codegen the RHS.
Modified: llvm/trunk/examples/Kaleidoscope/MCJIT/complete/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/MCJIT/complete/toy.cpp?rev=235543&r1=235542&r2=235543&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/MCJIT/complete/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/MCJIT/complete/toy.cpp Wed Apr 22 15:58:34 2015
@@ -1113,7 +1113,7 @@ Value *BinaryExprAST::Codegen() {
// This assume we're building without RTTI because LLVM builds that way by
// default. If you build LLVM with RTTI this can be changed to a
// dynamic_cast for automatic error checking.
- VariableExprAST *LHSE = reinterpret_cast<VariableExprAST*>(LHS);
+ VariableExprAST *LHSE = static_cast<VariableExprAST*>(LHS);
if (!LHSE)
return ErrorV("destination of '=' must be a variable");
// Codegen the RHS.
Modified: llvm/trunk/examples/Kaleidoscope/MCJIT/initial/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/MCJIT/initial/toy.cpp?rev=235543&r1=235542&r2=235543&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/MCJIT/initial/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/MCJIT/initial/toy.cpp Wed Apr 22 15:58:34 2015
@@ -897,7 +897,7 @@ Value *BinaryExprAST::Codegen() {
// Special case '=' because we don't want to emit the LHS as an expression.
if (Op == '=') {
// Assignment requires the LHS to be an identifier.
- VariableExprAST *LHSE = reinterpret_cast<VariableExprAST*>(LHS);
+ VariableExprAST *LHSE = static_cast<VariableExprAST*>(LHS);
if (!LHSE)
return ErrorV("destination of '=' must be a variable");
// Codegen the RHS.
Modified: llvm/trunk/examples/Kaleidoscope/MCJIT/lazy/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/MCJIT/lazy/toy.cpp?rev=235543&r1=235542&r2=235543&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/MCJIT/lazy/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/MCJIT/lazy/toy.cpp Wed Apr 22 15:58:34 2015
@@ -937,7 +937,7 @@ Value *BinaryExprAST::Codegen() {
// Special case '=' because we don't want to emit the LHS as an expression.
if (Op == '=') {
// Assignment requires the LHS to be an identifier.
- VariableExprAST *LHSE = reinterpret_cast<VariableExprAST*>(LHS);
+ VariableExprAST *LHSE = static_cast<VariableExprAST*>(LHS);
if (!LHSE)
return ErrorV("destination of '=' must be a variable");
// Codegen the RHS.
More information about the llvm-commits
mailing list