summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/FunctionIndexObjectFile.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2015-11-19 05:52:29 +0000
committerMehdi Amini <mehdi.amini@apple.com>2015-11-19 05:52:29 +0000
commit354f520fbcb0a410a56a3f543640f434cb2d1fa2 (patch)
treef07267e11a60e3bf82517c1c8a84ee0369c21ff6 /llvm/lib/Object/FunctionIndexObjectFile.cpp
parent00aecfc388173f94e532e376662ff26198064a83 (diff)
downloadbcm5719-llvm-354f520fbcb0a410a56a3f543640f434cb2d1fa2.tar.gz
bcm5719-llvm-354f520fbcb0a410a56a3f543640f434cb2d1fa2.zip
Do not require a Context to extract the FunctionIndex from Bitcode (NFC)
The LLVMContext was only used for Diagnostic. Pass a DiagnosticHandler instead. Differential Revision: http://reviews.llvm.org/D14794 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 253540
Diffstat (limited to 'llvm/lib/Object/FunctionIndexObjectFile.cpp')
-rw-r--r--llvm/lib/Object/FunctionIndexObjectFile.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Object/FunctionIndexObjectFile.cpp b/llvm/lib/Object/FunctionIndexObjectFile.cpp
index ee65990c528..f4b2b5562a3 100644
--- a/llvm/lib/Object/FunctionIndexObjectFile.cpp
+++ b/llvm/lib/Object/FunctionIndexObjectFile.cpp
@@ -72,19 +72,20 @@ FunctionIndexObjectFile::findBitcodeInMemBuffer(MemoryBufferRef Object) {
// Looks for function index in the given memory buffer.
// returns true if found, else false.
bool FunctionIndexObjectFile::hasFunctionSummaryInMemBuffer(
- MemoryBufferRef Object, LLVMContext &Context) {
+ MemoryBufferRef Object, DiagnosticHandlerFunction DiagnosticHandler) {
ErrorOr<MemoryBufferRef> BCOrErr = findBitcodeInMemBuffer(Object);
if (!BCOrErr)
return false;
- return hasFunctionSummary(BCOrErr.get(), Context, nullptr);
+ return hasFunctionSummary(BCOrErr.get(), DiagnosticHandler);
}
// Parse function index in the given memory buffer.
// Return new FunctionIndexObjectFile instance containing parsed
// function summary/index.
ErrorOr<std::unique_ptr<FunctionIndexObjectFile>>
-FunctionIndexObjectFile::create(MemoryBufferRef Object, LLVMContext &Context,
+FunctionIndexObjectFile::create(MemoryBufferRef Object,
+ DiagnosticHandlerFunction DiagnosticHandler,
const Module *ExportingModule, bool IsLazy) {
std::unique_ptr<FunctionInfoIndex> Index;
@@ -93,7 +94,7 @@ FunctionIndexObjectFile::create(MemoryBufferRef Object, LLVMContext &Context,
return BCOrErr.getError();
ErrorOr<std::unique_ptr<FunctionInfoIndex>> IOrErr = getFunctionInfoIndex(
- BCOrErr.get(), Context, nullptr, ExportingModule, IsLazy);
+ BCOrErr.get(), DiagnosticHandler, ExportingModule, IsLazy);
if (std::error_code EC = IOrErr.getError())
return EC;
@@ -107,11 +108,12 @@ FunctionIndexObjectFile::create(MemoryBufferRef Object, LLVMContext &Context,
// given name out of the given buffer. Parsed information is
// stored on the index object saved in this object.
std::error_code FunctionIndexObjectFile::findFunctionSummaryInMemBuffer(
- MemoryBufferRef Object, LLVMContext &Context, StringRef FunctionName) {
+ MemoryBufferRef Object, DiagnosticHandlerFunction DiagnosticHandler,
+ StringRef FunctionName) {
sys::fs::file_magic Type = sys::fs::identify_magic(Object.getBuffer());
switch (Type) {
case sys::fs::file_magic::bitcode: {
- return readFunctionSummary(Object, Context, nullptr, FunctionName,
+ return readFunctionSummary(Object, DiagnosticHandler, FunctionName,
std::move(Index));
}
default:
OpenPOWER on IntegriCloud