diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-04-14 21:59:01 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-04-14 21:59:01 +0000 |
commit | 03b42e41bf4bdd9ab05ea4c6905bae5d19971960 (patch) | |
tree | d4249845a564b11af673299653e7c4e876d8c4f2 /llvm/lib/Target/CppBackend/CPPBackend.cpp | |
parent | 3d1c1deb04efe0022f11ebc18bb43d7341ba0c75 (diff) | |
download | bcm5719-llvm-03b42e41bf4bdd9ab05ea4c6905bae5d19971960.tar.gz bcm5719-llvm-03b42e41bf4bdd9ab05ea4c6905bae5d19971960.zip |
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
Diffstat (limited to 'llvm/lib/Target/CppBackend/CPPBackend.cpp')
-rw-r--r-- | llvm/lib/Target/CppBackend/CPPBackend.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/CppBackend/CPPBackend.cpp b/llvm/lib/Target/CppBackend/CPPBackend.cpp index a086e710d16..bc2bf155c51 100644 --- a/llvm/lib/Target/CppBackend/CPPBackend.cpp +++ b/llvm/lib/Target/CppBackend/CPPBackend.cpp @@ -1947,6 +1947,7 @@ void CppWriter::printProgram(const std::string& fname, Out << "#include <llvm/Support/MathExtras.h>\n"; Out << "#include <algorithm>\n"; Out << "using namespace llvm;\n\n"; + Out << "static LLVMContext TheContext;\n\n"; Out << "Module* " << fname << "();\n\n"; Out << "int main(int argc, char**argv) {\n"; Out << " Module* Mod = " << fname << "();\n"; @@ -1965,7 +1966,7 @@ void CppWriter::printModule(const std::string& fname, nl(Out,1) << "// Module Construction"; nl(Out) << "Module* mod = new Module(\""; printEscapedString(mName); - Out << "\", getGlobalContext());"; + Out << "\", TheContext);"; if (!TheModule->getTargetTriple().empty()) { nl(Out) << "mod->setDataLayout(\"" << TheModule->getDataLayoutStr() << "\");"; |