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/Chapter7/toy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/examples/Kaleidoscope/Chapter7/toy.cpp') 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