summaryrefslogtreecommitdiffstats
path: root/llvm/examples/Kaleidoscope/Chapter6/toy.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-05-22 22:48:36 +0000
committerLang Hames <lhames@gmail.com>2016-05-22 22:48:36 +0000
commit247968041a27e45df067ba878369193bbfb5ed63 (patch)
tree44ea65ee7b064a834b480590ec7580066550bbf4 /llvm/examples/Kaleidoscope/Chapter6/toy.cpp
parent69a710c03d3025fbfad2c0cb77579a0ee8237bdf (diff)
downloadbcm5719-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
Diffstat (limited to 'llvm/examples/Kaleidoscope/Chapter6/toy.cpp')
-rw-r--r--llvm/examples/Kaleidoscope/Chapter6/toy.cpp2
1 files changed, 1 insertions, 1 deletions
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;
OpenPOWER on IntegriCloud