[examples] Fix Kaleidoscope-Ch3, which was broken by ad92f16ccc5.
authorLang Hames <lhames@gmail.com>
Mon, 19 Oct 2020 07:25:15 +0000 (00:25 -0700)
committerLang Hames <lhames@gmail.com>
Mon, 19 Oct 2020 07:26:43 +0000 (00:26 -0700)
llvm/examples/Kaleidoscope/Chapter3/toy.cpp

index 61adfbc..0356300 100644 (file)
@@ -533,9 +533,6 @@ static void HandleDefinition() {
       fprintf(stderr, "Read function definition:");
       FnIR->print(errs());
       fprintf(stderr, "\n");
-
-      // Reset the module.
-      InitializeModule();
     }
   } else {
     // Skip token for error recovery.
@@ -564,8 +561,8 @@ static void HandleTopLevelExpression() {
       FnIR->print(errs());
       fprintf(stderr, "\n");
 
-      // Reset the module.
-      InitializeModule();
+      // Remove the anonymous expression.
+      FnIR->eraseFromParent();
     }
   } else {
     // Skip token for error recovery.