Skip to content

Commit 3cf6d41

Browse files
authored
removes ambigous utility function (#593)
1 parent f56c2dd commit 3cf6d41

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

include/remill/BC/Util.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,6 @@ bool VerifyModule(llvm::Module *module);
153153
// Returns diagnostic message if verify failed.
154154
std::optional<std::string> VerifyModuleMsg(llvm::Module *module);
155155

156-
// Parses and loads a bitcode file into memory.
157-
std::unique_ptr<llvm::Module>
158-
LoadModuleFromFile(llvm::LLVMContext *context,
159-
std::string_view file_name,
160-
bool allow_failure = false) __attribute__((__deprecated__));
161156

162157
std::unique_ptr<llvm::Module> LoadModuleFromFile(llvm::LLVMContext *context,
163158
std::filesystem::path file_name);

lib/BC/Util.cpp

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -426,38 +426,28 @@ bool VerifyModule(llvm::Module *module) {
426426
}
427427

428428
std::unique_ptr<llvm::Module> LoadModuleFromFile(llvm::LLVMContext *context,
429-
std::filesystem::path path)
429+
std::filesystem::path file_name)
430430
{
431-
// NOTE(lukas): Calling deprecated function, once it is remove its body
432-
// will be more or less inlined.
433-
return LoadModuleFromFile(context, path.string(), true);
434-
}
435-
436-
// Reads an LLVM module from a file.
437-
std::unique_ptr<llvm::Module> LoadModuleFromFile(llvm::LLVMContext *context,
438-
std::string_view file_name_,
439-
bool allow_failure) {
440431
llvm::SMDiagnostic err;
441-
llvm::StringRef file_name(file_name_.data(), file_name_.size());
442-
auto module = llvm::parseIRFile(file_name, err, *context);
432+
auto module = llvm::parseIRFile(file_name.string(), err, *context);
443433

444434
if (!module) {
445-
LOG_IF(FATAL, !allow_failure)
446-
<< "Unable to parse module file " << file_name_ << ": "
435+
LOG(ERROR)
436+
<< "Unable to parse module file " << file_name << ": "
447437
<< err.getMessage().str();
448438
return {};
449439
}
450440

451441
auto ec = module->materializeAll(); // Just in case.
452442
if (ec) {
453-
LOG_IF(FATAL, !allow_failure)
454-
<< "Unable to materialize everything from " << file_name_;
443+
LOG(ERROR)
444+
<< "Unable to materialize everything from " << file_name;
455445
return {};
456446
}
457447

458448
if (!VerifyModule(module.get())) {
459-
LOG_IF(FATAL, !allow_failure)
460-
<< "Error verifying module read from file " << file_name_;
449+
LOG(ERROR)
450+
<< "Error verifying module read from file " << file_name;
461451
return {};
462452
}
463453

0 commit comments

Comments
 (0)