createOutputFile should set Error to something if it returns null.

This is not portably unit-testable because the only visible
effect is a change from one random message string to another.

llvm-svn: 247900
This commit is contained in:
Douglas Katzman 2015-09-17 16:45:12 +00:00
parent b01310008f
commit 8bfac2c553
1 changed files with 3 additions and 1 deletions

View File

@ -641,8 +641,10 @@ std::unique_ptr<llvm::raw_pwrite_stream> CompilerInstance::createOutputFile(
llvm::sys::fs::status(OutputPath, Status);
if (llvm::sys::fs::exists(Status)) {
// Fail early if we can't write to the final destination.
if (!llvm::sys::fs::can_write(OutputPath))
if (!llvm::sys::fs::can_write(OutputPath)) {
Error = std::make_error_code(std::errc::operation_not_permitted);
return nullptr;
}
// Don't use a temporary if the output is a special file. This handles
// things like '-o /dev/null'