[Kaleidoscope] Remove RTTI use from chapters 7 and 8.
authorLang Hames <lhames@gmail.com>
Wed, 22 Apr 2015 20:41:34 +0000 (20:41 +0000)
committerLang Hames <lhames@gmail.com>
Wed, 22 Apr 2015 20:41:34 +0000 (20:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235541 91177308-0d34-0410-b5e6-96231b3b80d8

examples/Kaleidoscope/Chapter7/CMakeLists.txt
examples/Kaleidoscope/Chapter7/Makefile
examples/Kaleidoscope/Chapter7/toy.cpp
examples/Kaleidoscope/Chapter8/CMakeLists.txt
examples/Kaleidoscope/Chapter8/Makefile
examples/Kaleidoscope/Chapter8/toy.cpp

index 23aba6510b8c07ed8116bc76c159fa9f6a2e12a5..8725e4761f785368ce18f8e23f0f3f9ad45f40b8 100644 (file)
@@ -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
   )
index 7abeb3e5b67ce544644166fc7650a7990f7b4ded..c672c0a36c63fee34acc944b5e1a91782cf6ada5 100644 (file)
@@ -9,7 +9,6 @@
 LEVEL = ../../..
 TOOLNAME = Kaleidoscope-Ch7
 EXAMPLE_TOOL = 1
-REQUIRES_RTTI := 1
 
 LINK_COMPONENTS := core mcjit native
 
index 53ea51c2b9c5383b337c35b9c661d876329d533b..acf21f898f83ede74764b42dc13fac6a9378ef97 100644 (file)
@@ -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.
index 90c79c0b9ae9d08906d605a6a94fd971c0eace19..f94ed7436189b23730172de26af0cab59aab5c6a 100644 (file)
@@ -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
   )
index 8e4d42211786ede9e38ed37eba1c4f25274da51d..25f048c39b0a4533d01562851827adf6f28c274d 100644 (file)
@@ -9,7 +9,6 @@
 LEVEL = ../../..
 TOOLNAME = Kaleidoscope-Ch8
 EXAMPLE_TOOL = 1
-REQUIRES_RTTI := 1
 
 LINK_COMPONENTS := core mcjit native
 
index eb16516b6d23c57b87f9bea115dbcfbcaacc906c..6ab0eaeca30ea647a63e09d74baf218d4d6864e7 100644 (file)
@@ -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.