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/unittests/Analysis/LoopPassManagerTest.cpp | |
parent | 3d1c1deb04efe0022f11ebc18bb43d7341ba0c75 (diff) | |
download | llvm-03b42e41bf4bdd9ab05ea4c6905bae5d19971960.zip llvm-03b42e41bf4bdd9ab05ea4c6905bae5d19971960.tar.gz llvm-03b42e41bf4bdd9ab05ea4c6905bae5d19971960.tar.bz2 |
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/unittests/Analysis/LoopPassManagerTest.cpp')
-rw-r--r-- | llvm/unittests/Analysis/LoopPassManagerTest.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/llvm/unittests/Analysis/LoopPassManagerTest.cpp b/llvm/unittests/Analysis/LoopPassManagerTest.cpp index 8a62049..3cbe203 100644 --- a/llvm/unittests/Analysis/LoopPassManagerTest.cpp +++ b/llvm/unittests/Analysis/LoopPassManagerTest.cpp @@ -99,39 +99,39 @@ public: static StringRef name() { return "TestLoopInvalidatingPass"; } }; -std::unique_ptr<Module> parseIR(const char *IR) { - LLVMContext &C = getGlobalContext(); +std::unique_ptr<Module> parseIR(LLVMContext &C, const char *IR) { SMDiagnostic Err; return parseAssemblyString(IR, Err, C); } class LoopPassManagerTest : public ::testing::Test { protected: + LLVMContext Context; std::unique_ptr<Module> M; public: LoopPassManagerTest() - : M(parseIR("define void @f() {\n" - "entry:\n" - " br label %loop.0\n" - "loop.0:\n" - " br i1 undef, label %loop.0.0, label %end\n" - "loop.0.0:\n" - " br i1 undef, label %loop.0.0, label %loop.0.1\n" - "loop.0.1:\n" - " br i1 undef, label %loop.0.1, label %loop.0\n" - "end:\n" - " ret void\n" - "}\n" - "\n" - "define void @g() {\n" - "entry:\n" - " br label %loop.g.0\n" - "loop.g.0:\n" - " br i1 undef, label %loop.g.0, label %end\n" - "end:\n" - " ret void\n" - "}\n")) {} + : M(parseIR(Context, "define void @f() {\n" + "entry:\n" + " br label %loop.0\n" + "loop.0:\n" + " br i1 undef, label %loop.0.0, label %end\n" + "loop.0.0:\n" + " br i1 undef, label %loop.0.0, label %loop.0.1\n" + "loop.0.1:\n" + " br i1 undef, label %loop.0.1, label %loop.0\n" + "end:\n" + " ret void\n" + "}\n" + "\n" + "define void @g() {\n" + "entry:\n" + " br label %loop.g.0\n" + "loop.g.0:\n" + " br i1 undef, label %loop.g.0, label %end\n" + "end:\n" + " ret void\n" + "}\n")) {} }; #define EXPECT_N_ELEMENTS_EQ(N, EXPECTED, ACTUAL) \ |