From 03b42e41bf4bdd9ab05ea4c6905bae5d19971960 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 14 Apr 2016 21:59:01 +0000 Subject: 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 llvm-svn: 266379 --- llvm/tools/llvm-profdata/llvm-profdata.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp') diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 046e82fa6ed..f8489cccef0 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -164,9 +164,9 @@ static void mergeSampleProfile(const WeightedFileVector &Inputs, auto Writer = std::move(WriterOrErr.get()); StringMap ProfileMap; SmallVector, 5> Readers; + LLVMContext Context; for (const auto &Input : Inputs) { - auto ReaderOrErr = - SampleProfileReader::create(Input.Filename, getGlobalContext()); + auto ReaderOrErr = SampleProfileReader::create(Input.Filename, Context); if (std::error_code EC = ReaderOrErr.getError()) exitWithErrorCode(EC, Input.Filename); @@ -365,7 +365,8 @@ static int showSampleProfile(std::string Filename, bool ShowCounts, bool ShowAllFunctions, std::string ShowFunction, raw_fd_ostream &OS) { using namespace sampleprof; - auto ReaderOrErr = SampleProfileReader::create(Filename, getGlobalContext()); + LLVMContext Context; + auto ReaderOrErr = SampleProfileReader::create(Filename, Context); if (std::error_code EC = ReaderOrErr.getError()) exitWithErrorCode(EC, Filename); -- cgit v1.2.3