diff options
author | Douglas Katzman <dougk@google.com> | 2015-09-17 16:45:12 +0000 |
---|---|---|
committer | Douglas Katzman <dougk@google.com> | 2015-09-17 16:45:12 +0000 |
commit | 8bfac2c553ffa3d30a1fb9a5c8d40c1f89d03af0 (patch) | |
tree | f74315fe0ff8253a1ece4a89a3c6545606670191 /clang/lib/Frontend/CompilerInstance.cpp | |
parent | b01310008ff743d9736fabff933e739ed97196cf (diff) | |
download | llvm-8bfac2c553ffa3d30a1fb9a5c8d40c1f89d03af0.zip llvm-8bfac2c553ffa3d30a1fb9a5c8d40c1f89d03af0.tar.gz llvm-8bfac2c553ffa3d30a1fb9a5c8d40c1f89d03af0.tar.bz2 |
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
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index dfd71af..3326b81 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -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' |