From 247968041a27e45df067ba878369193bbfb5ed63 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Sun, 22 May 2016 22:48:36 +0000 Subject: [Kaleidoscope] Fix static global ordering to prevent crash on exit. If TheModule is declared before LLVMContext then it will be destructed after it, crashing when it tries to deregister itself from the destructed context. llvm-svn: 270381 --- llvm/examples/Kaleidoscope/Chapter3/toy.cpp | 2 +- llvm/examples/Kaleidoscope/Chapter4/toy.cpp | 2 +- llvm/examples/Kaleidoscope/Chapter5/toy.cpp | 2 +- llvm/examples/Kaleidoscope/Chapter6/toy.cpp | 2 +- llvm/examples/Kaleidoscope/Chapter7/toy.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'llvm') diff --git a/llvm/examples/Kaleidoscope/Chapter3/toy.cpp b/llvm/examples/Kaleidoscope/Chapter3/toy.cpp index d6c5165a98d..cdf0d6c8cdb 100644 --- a/llvm/examples/Kaleidoscope/Chapter3/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter3/toy.cpp @@ -388,9 +388,9 @@ static std::unique_ptr ParseExtern() { // Code Generation //===----------------------------------------------------------------------===// -static std::unique_ptr TheModule; static LLVMContext TheContext; static IRBuilder<> Builder(TheContext); +static std::unique_ptr TheModule; static std::map NamedValues; Value *LogErrorV(const char *Str) { diff --git a/llvm/examples/Kaleidoscope/Chapter4/toy.cpp b/llvm/examples/Kaleidoscope/Chapter4/toy.cpp index 6481b7733a1..836a2053cbe 100644 --- a/llvm/examples/Kaleidoscope/Chapter4/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter4/toy.cpp @@ -397,9 +397,9 @@ static std::unique_ptr ParseExtern() { // Code Generation //===----------------------------------------------------------------------===// -static std::unique_ptr TheModule; static LLVMContext TheContext; static IRBuilder<> Builder(TheContext); +static std::unique_ptr TheModule; static std::map NamedValues; static std::unique_ptr TheFPM; static std::unique_ptr TheJIT; diff --git a/llvm/examples/Kaleidoscope/Chapter5/toy.cpp b/llvm/examples/Kaleidoscope/Chapter5/toy.cpp index e62f27d0730..a080bd00cb5 100644 --- a/llvm/examples/Kaleidoscope/Chapter5/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter5/toy.cpp @@ -522,9 +522,9 @@ static std::unique_ptr ParseExtern() { // Code Generation //===----------------------------------------------------------------------===// -static std::unique_ptr TheModule; static LLVMContext TheContext; static IRBuilder<> Builder(TheContext); +static std::unique_ptr TheModule; static std::map NamedValues; static std::unique_ptr TheFPM; static std::unique_ptr TheJIT; diff --git a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp index 58c6f9ada17..85d953b0c75 100644 --- a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp @@ -613,9 +613,9 @@ static std::unique_ptr ParseExtern() { // Code Generation //===----------------------------------------------------------------------===// -static std::unique_ptr TheModule; static LLVMContext TheContext; static IRBuilder<> Builder(TheContext); +static std::unique_ptr TheModule; static std::map NamedValues; static std::unique_ptr TheFPM; static std::unique_ptr TheJIT; diff --git a/llvm/examples/Kaleidoscope/Chapter7/toy.cpp b/llvm/examples/Kaleidoscope/Chapter7/toy.cpp index fffbfba286c..3206ca8c5d7 100644 --- a/llvm/examples/Kaleidoscope/Chapter7/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter7/toy.cpp @@ -684,9 +684,9 @@ static std::unique_ptr ParseExtern() { // Code Generation //===----------------------------------------------------------------------===// -static std::unique_ptr TheModule; static LLVMContext TheContext; static IRBuilder<> Builder(TheContext); +static std::unique_ptr TheModule; static std::map NamedValues; static std::unique_ptr TheFPM; static std::unique_ptr TheJIT; -- cgit v1.2.3