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 | 8be7707c14f9eafd5e6eebd1a167c706a2f998f1 (patch) | |
tree | 7ba1fe5ff65c10c7398fe83e76283fc2b5e04eda /unittests/AsmParser | |
parent | 6d955a1d6dfb81f23dd8fd1829635eed96652b22 (diff) |
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>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/AsmParser')
-rw-r--r-- | unittests/AsmParser/AsmParserTest.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/unittests/AsmParser/AsmParserTest.cpp b/unittests/AsmParser/AsmParserTest.cpp index 38810cd7c7a5..ddbedd05c7ba 100644 --- a/unittests/AsmParser/AsmParserTest.cpp +++ b/unittests/AsmParser/AsmParserTest.cpp @@ -21,7 +21,7 @@ using namespace llvm; namespace { TEST(AsmParserTest, NullTerminatedInput) { - LLVMContext &Ctx = getGlobalContext(); + LLVMContext Ctx; StringRef Source = "; Empty module \n"; SMDiagnostic Error; auto Mod = parseAssemblyString(Source, Error, Ctx); @@ -34,7 +34,7 @@ TEST(AsmParserTest, NullTerminatedInput) { #ifndef NDEBUG TEST(AsmParserTest, NonNullTerminatedInput) { - LLVMContext &Ctx = getGlobalContext(); + LLVMContext Ctx; StringRef Source = "; Empty module \n\1\2"; SMDiagnostic Error; std::unique_ptr<Module> Mod; @@ -47,7 +47,7 @@ TEST(AsmParserTest, NonNullTerminatedInput) { #endif TEST(AsmParserTest, SlotMappingTest) { - LLVMContext &Ctx = getGlobalContext(); + LLVMContext Ctx; StringRef Source = "@0 = global i32 0\n !0 = !{}\n !42 = !{i32 42}"; SMDiagnostic Error; SlotMapping Mapping; @@ -66,7 +66,7 @@ TEST(AsmParserTest, SlotMappingTest) { } TEST(AsmParserTest, TypeAndConstantValueParsing) { - LLVMContext &Ctx = getGlobalContext(); + LLVMContext Ctx; SMDiagnostic Error; StringRef Source = "define void @test() {\n entry:\n ret void\n}"; auto Mod = parseAssemblyString(Source, Error, Ctx); @@ -117,7 +117,7 @@ TEST(AsmParserTest, TypeAndConstantValueParsing) { } TEST(AsmParserTest, TypeAndConstantValueWithSlotMappingParsing) { - LLVMContext &Ctx = getGlobalContext(); + LLVMContext Ctx; SMDiagnostic Error; StringRef Source = "%st = type { i32, i32 }\n" @@ -153,7 +153,7 @@ TEST(AsmParserTest, TypeAndConstantValueWithSlotMappingParsing) { } TEST(AsmParserTest, TypeWithSlotMappingParsing) { - LLVMContext &Ctx = getGlobalContext(); + LLVMContext Ctx; SMDiagnostic Error; StringRef Source = "%st = type { i32, i32 }\n" @@ -277,7 +277,7 @@ TEST(AsmParserTest, TypeWithSlotMappingParsing) { } TEST(AsmParserTest, TypeAtBeginningWithSlotMappingParsing) { - LLVMContext &Ctx = getGlobalContext(); + LLVMContext Ctx; SMDiagnostic Error; StringRef Source = "%st = type { i32, i32 }\n" |