Use check() to report an error.

llvm-svn: 305033
This commit is contained in:
Rui Ueyama 2017-06-08 23:43:44 +00:00
parent 3eedd16114
commit 67aea737f3

View File

@ -456,17 +456,11 @@ static void createImportLibrary() {
static void parseModuleDefs(StringRef Path) {
std::unique_ptr<MemoryBuffer> MB = check(
MemoryBuffer::getFile(Path, -1, false, true), "could not open " + Path);
MemoryBufferRef MBRef = MB->getMemBufferRef();
COFFModuleDefinition M =
check(parseCOFFModuleDefinition(MB->getMemBufferRef(), Config->Machine));
Expected<COFFModuleDefinition> Def =
parseCOFFModuleDefinition(MBRef, Config->Machine);
if (!Def)
fatal(errorToErrorCode(Def.takeError()).message());
COFFModuleDefinition &M = *Def;
if (Config->OutputFile.empty())
Config->OutputFile = Saver.save(M.OutputFile);
if (M.ImageBase)
Config->ImageBase = M.ImageBase;
if (M.StackReserve)