summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2015-04-22 20:41:34 +0000
committerLang Hames <lhames@gmail.com>2015-04-22 20:41:34 +0000
commitfd491461fc4bf24de4b29d5fba6f2c09c5d2311f (patch)
treea455476b9aaf7af3e5e36f72d6825b74d3e61443
parent2adb40ecb690c3c647bb9996577d823929f39e1e (diff)
[Kaleidoscope] Remove RTTI use from chapters 7 and 8.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235541 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--examples/Kaleidoscope/Chapter7/CMakeLists.txt4
-rw-r--r--examples/Kaleidoscope/Chapter7/Makefile1
-rw-r--r--examples/Kaleidoscope/Chapter7/toy.cpp5
-rw-r--r--examples/Kaleidoscope/Chapter8/CMakeLists.txt4
-rw-r--r--examples/Kaleidoscope/Chapter8/Makefile1
-rw-r--r--examples/Kaleidoscope/Chapter8/toy.cpp5
6 files changed, 8 insertions, 12 deletions
diff --git a/examples/Kaleidoscope/Chapter7/CMakeLists.txt b/examples/Kaleidoscope/Chapter7/CMakeLists.txt
index 23aba6510b..8725e4761f 100644
--- a/examples/Kaleidoscope/Chapter7/CMakeLists.txt
+++ b/examples/Kaleidoscope/Chapter7/CMakeLists.txt
@@ -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
)
diff --git a/examples/Kaleidoscope/Chapter7/Makefile b/examples/Kaleidoscope/Chapter7/Makefile
index 7abeb3e5b6..c672c0a36c 100644
--- a/examples/Kaleidoscope/Chapter7/Makefile
+++ b/examples/Kaleidoscope/Chapter7/Makefile
@@ -9,7 +9,6 @@
LEVEL = ../../..
TOOLNAME = Kaleidoscope-Ch7
EXAMPLE_TOOL = 1
-REQUIRES_RTTI := 1
LINK_COMPONENTS := core mcjit native
diff --git a/examples/Kaleidoscope/Chapter7/toy.cpp b/examples/Kaleidoscope/Chapter7/toy.cpp
index 53ea51c2b9..acf21f898f 100644
--- a/examples/Kaleidoscope/Chapter7/toy.cpp
+++ b/examples/Kaleidoscope/Chapter7/toy.cpp
@@ -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.
diff --git a/examples/Kaleidoscope/Chapter8/CMakeLists.txt b/examples/Kaleidoscope/Chapter8/CMakeLists.txt
index 90c79c0b9a..f94ed74361 100644
--- a/examples/Kaleidoscope/Chapter8/CMakeLists.txt
+++ b/examples/Kaleidoscope/Chapter8/CMakeLists.txt
@@ -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
)
diff --git a/examples/Kaleidoscope/Chapter8/Makefile b/examples/Kaleidoscope/Chapter8/Makefile
index 8e4d422117..25f048c39b 100644
--- a/examples/Kaleidoscope/Chapter8/Makefile
+++ b/examples/Kaleidoscope/Chapter8/Makefile
@@ -9,7 +9,6 @@
LEVEL = ../../..
TOOLNAME = Kaleidoscope-Ch8
EXAMPLE_TOOL = 1
-REQUIRES_RTTI := 1
LINK_COMPONENTS := core mcjit native
diff --git a/examples/Kaleidoscope/Chapter8/toy.cpp b/examples/Kaleidoscope/Chapter8/toy.cpp
index eb16516b6d..6ab0eaeca3 100644
--- a/examples/Kaleidoscope/Chapter8/toy.cpp
+++ b/examples/Kaleidoscope/Chapter8/toy.cpp
@@ -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.