Modernize raw_fd_ostream's constructor a bit.
[oota-llvm.git] / tools / llc / llc.cpp
index 01196d5c819dfedf652c8abd59fa0622ed8a746d..aef86b22ce0f93f028c0881d7b8cfc51bf3000c3 100644 (file)
@@ -159,14 +159,13 @@ static tool_output_file *GetOutputStream(const char *TargetName,
   }
 
   // Open the file.
-  std::string error;
+  std::error_code EC;
   sys::fs::OpenFlags OpenFlags = sys::fs::F_None;
   if (!Binary)
     OpenFlags |= sys::fs::F_Text;
-  tool_output_file *FDOut = new tool_output_file(OutputFilename.c_str(), error,
-                                                 OpenFlags);
-  if (!error.empty()) {
-    errs() << error << '\n';
+  tool_output_file *FDOut = new tool_output_file(OutputFilename, EC, OpenFlags);
+  if (EC) {
+    errs() << EC.message() << '\n';
     delete FDOut;
     return nullptr;
   }