Remove every uses of getGlobalContext() in LLVM (but the C API)
At the same time, fixes InstructionsTest::CastInst unittest: yes
you can leave the IR in an invalid state and exit when you don't
destroy the context (like the global one), no longer now.
This is the first part of http://reviews.llvm.org/D19094
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266379
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index a27ce73..ca3ab8a 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -316,7 +316,7 @@
EnableDebugBuffering = true;
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
- LLVMContext &Context = getGlobalContext();
+ LLVMContext Context;
InitializeAllTargets();
InitializeAllTargetMCs();