[llvm] r235541 - [Kaleidoscope] Remove RTTI use from chapters 7 and 8.
Lang Hames
lhames at gmail.com
Wed Apr 22 13:41:34 PDT 2015
Author: lhames
Date: Wed Apr 22 15:41:34 2015
New Revision: 235541
URL: http://llvm.org/viewvc/llvm-project?rev=235541&view=rev
Log:
[Kaleidoscope] Remove RTTI use from chapters 7 and 8.
Modified:
llvm/trunk/examples/Kaleidoscope/Chapter7/CMakeLists.txt
llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile
llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp
llvm/trunk/examples/Kaleidoscope/Chapter8/CMakeLists.txt
llvm/trunk/examples/Kaleidoscope/Chapter8/Makefile
llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp
Modified: llvm/trunk/examples/Kaleidoscope/Chapter7/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter7/CMakeLists.txt?rev=235541&r1=235540&r2=235541&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter7/CMakeLists.txt (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter7/CMakeLists.txt Wed Apr 22 15:41:34 2015
@@ -11,10 +11,6 @@ set(LLVM_LINK_COMPONENTS
native
)
-set(LLVM_REQUIRES_RTTI 1)
-
-set(LLVM_BUILD_EXAMPLES OFF)
-
add_kaleidoscope_chapter(Kaleidoscope-Ch7
toy.cpp
)
Modified: llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile?rev=235541&r1=235540&r2=235541&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter7/Makefile Wed Apr 22 15:41:34 2015
@@ -9,7 +9,6 @@
LEVEL = ../../..
TOOLNAME = Kaleidoscope-Ch7
EXAMPLE_TOOL = 1
-REQUIRES_RTTI := 1
LINK_COMPONENTS := core mcjit native
Modified: llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp?rev=235541&r1=235540&r2=235541&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp Wed Apr 22 15:41:34 2015
@@ -713,7 +713,10 @@ 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 = dynamic_cast<VariableExprAST *>(LHS);
+ // 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);
if (!LHSE)
return ErrorV("destination of '=' must be a variable");
// Codegen the RHS.
Modified: llvm/trunk/examples/Kaleidoscope/Chapter8/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter8/CMakeLists.txt?rev=235541&r1=235540&r2=235541&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter8/CMakeLists.txt (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter8/CMakeLists.txt Wed Apr 22 15:41:34 2015
@@ -7,10 +7,6 @@ set(LLVM_LINK_COMPONENTS
native
)
-set(LLVM_REQUIRES_RTTI 1)
-
-set(LLVM_BUILD_EXAMPLES OFF)
-
add_kaleidoscope_chapter(Kaleidoscope-Ch8
toy.cpp
)
Modified: llvm/trunk/examples/Kaleidoscope/Chapter8/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter8/Makefile?rev=235541&r1=235540&r2=235541&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter8/Makefile (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter8/Makefile Wed Apr 22 15:41:34 2015
@@ -9,7 +9,6 @@
LEVEL = ../../..
TOOLNAME = Kaleidoscope-Ch8
EXAMPLE_TOOL = 1
-REQUIRES_RTTI := 1
LINK_COMPONENTS := core mcjit native
Modified: llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp?rev=235541&r1=235540&r2=235541&view=diff
==============================================================================
--- llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp (original)
+++ llvm/trunk/examples/Kaleidoscope/Chapter8/toy.cpp Wed Apr 22 15:41:34 2015
@@ -908,7 +908,10 @@ 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 = dynamic_cast<VariableExprAST *>(LHS);
+ // 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);
if (!LHSE)
return ErrorV("destination of '=' must be a variable");
// Codegen the RHS.
More information about the llvm-commits
mailing list