From a885796d5fd85e4c7c71407feb48553ef7d4e258 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 26 Oct 2014 22:44:13 +0000 Subject: Make VFS and FileManager match the current MemoryBuffer API. This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657 --- clang/lib/CodeGen/CodeGenAction.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenAction.cpp') diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index 146c550c678..044eec643bb 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -647,18 +647,15 @@ CodeGenAction::CreateASTConsumer(CompilerInstance &CI, StringRef InFile) { // loaded from bitcode, do so now. const std::string &LinkBCFile = CI.getCodeGenOpts().LinkBitcodeFile; if (!LinkModuleToUse && !LinkBCFile.empty()) { - std::string ErrorStr; - - std::unique_ptr BCBuf = - CI.getFileManager().getBufferForFile(LinkBCFile, &ErrorStr); + auto BCBuf = CI.getFileManager().getBufferForFile(LinkBCFile); if (!BCBuf) { CI.getDiagnostics().Report(diag::err_cannot_open_file) - << LinkBCFile << ErrorStr; + << LinkBCFile << BCBuf.getError().message(); return nullptr; } ErrorOr ModuleOrErr = - getLazyBitcodeModule(std::move(BCBuf), *VMContext); + getLazyBitcodeModule(std::move(*BCBuf), *VMContext); if (std::error_code EC = ModuleOrErr.getError()) { CI.getDiagnostics().Report(diag::err_cannot_open_file) << LinkBCFile << EC.message(); -- cgit v1.2.3