diff options
Diffstat (limited to 'clang/tools/driver/cc1as_main.cpp')
-rw-r--r-- | clang/tools/driver/cc1as_main.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp index 2b4e97d8d8b..2393d198cc1 100644 --- a/clang/tools/driver/cc1as_main.cpp +++ b/clang/tools/driver/cc1as_main.cpp @@ -281,17 +281,18 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, if (!TheTarget) return Diags.Report(diag::err_target_unknown_triple) << Opts.Triple; - std::unique_ptr<MemoryBuffer> Buffer; - if (std::error_code ec = - MemoryBuffer::getFileOrSTDIN(Opts.InputFile, Buffer)) { - Error = ec.message(); + ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer = + MemoryBuffer::getFileOrSTDIN(Opts.InputFile); + + if (std::error_code EC = Buffer.getError()) { + Error = EC.message(); return Diags.Report(diag::err_fe_error_reading) << Opts.InputFile; } SourceMgr SrcMgr; // Tell SrcMgr about this buffer, which is what the parser will pick up. - SrcMgr.AddNewSourceBuffer(Buffer.release(), SMLoc()); + SrcMgr.AddNewSourceBuffer(Buffer->release(), SMLoc()); // Record the location of the include directories so that the lexer can find // it later. |