diff options
author | Lang Hames <lhames@gmail.com> | 2016-05-22 22:48:36 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2016-05-22 22:48:36 +0000 |
commit | 247968041a27e45df067ba878369193bbfb5ed63 (patch) | |
tree | 44ea65ee7b064a834b480590ec7580066550bbf4 | |
parent | 69a710c03d3025fbfad2c0cb77579a0ee8237bdf (diff) | |
download | bcm5719-llvm-247968041a27e45df067ba878369193bbfb5ed63.tar.gz bcm5719-llvm-247968041a27e45df067ba878369193bbfb5ed63.zip |
[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
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter3/toy.cpp | 2 | ||||
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter4/toy.cpp | 2 | ||||
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter5/toy.cpp | 2 | ||||
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter6/toy.cpp | 2 | ||||
-rw-r--r-- | llvm/examples/Kaleidoscope/Chapter7/toy.cpp | 2 |
5 files changed, 5 insertions, 5 deletions
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<PrototypeAST> ParseExtern() { // Code Generation //===----------------------------------------------------------------------===// -static std::unique_ptr<Module> TheModule; static LLVMContext TheContext; static IRBuilder<> Builder(TheContext); +static std::unique_ptr<Module> TheModule; static std::map<std::string, Value *> 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<PrototypeAST> ParseExtern() { // Code Generation //===----------------------------------------------------------------------===// -static std::unique_ptr<Module> TheModule; static LLVMContext TheContext; static IRBuilder<> Builder(TheContext); +static std::unique_ptr<Module> TheModule; static std::map<std::string, Value *> NamedValues; static std::unique_ptr<legacy::FunctionPassManager> TheFPM; static std::unique_ptr<KaleidoscopeJIT> 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<PrototypeAST> ParseExtern() { // Code Generation //===----------------------------------------------------------------------===// -static std::unique_ptr<Module> TheModule; static LLVMContext TheContext; static IRBuilder<> Builder(TheContext); +static std::unique_ptr<Module> TheModule; static std::map<std::string, Value *> NamedValues; static std::unique_ptr<legacy::FunctionPassManager> TheFPM; static std::unique_ptr<KaleidoscopeJIT> 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<PrototypeAST> ParseExtern() { // Code Generation //===----------------------------------------------------------------------===// -static std::unique_ptr<Module> TheModule; static LLVMContext TheContext; static IRBuilder<> Builder(TheContext); +static std::unique_ptr<Module> TheModule; static std::map<std::string, Value *> NamedValues; static std::unique_ptr<legacy::FunctionPassManager> TheFPM; static std::unique_ptr<KaleidoscopeJIT> 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<PrototypeAST> ParseExtern() { // Code Generation //===----------------------------------------------------------------------===// -static std::unique_ptr<Module> TheModule; static LLVMContext TheContext; static IRBuilder<> Builder(TheContext); +static std::unique_ptr<Module> TheModule; static std::map<std::string, AllocaInst *> NamedValues; static std::unique_ptr<legacy::FunctionPassManager> TheFPM; static std::unique_ptr<KaleidoscopeJIT> TheJIT; |