diff options
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/llvm-ar/llvm-ar.cpp | 1 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageView.cpp | 3 | ||||
-rw-r--r-- | llvm/tools/llvm-cov/TestingSupport.cpp | 3 | ||||
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp | 3 | ||||
-rw-r--r-- | llvm/tools/llvm-exegesis/llvm-exegesis.cpp | 9 | ||||
-rw-r--r-- | llvm/tools/llvm-rc/llvm-rc.cpp | 4 |
6 files changed, 14 insertions, 9 deletions
diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp index c85649949bc..9023bdd1a0d 100644 --- a/llvm/tools/llvm-ar/llvm-ar.cpp +++ b/llvm/tools/llvm-ar/llvm-ar.cpp @@ -390,6 +390,7 @@ static void doExtract(StringRef Name, const object::Archive::Child &C) { int FD; failIfError(sys::fs::openFileForWrite(sys::path::filename(Name), FD, + sys::fs::CD_CreateAlways, sys::fs::F_None, Mode), Name); diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp index 8c39dab580d..a5a8fa9a481 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp @@ -65,7 +65,8 @@ CoveragePrinter::createOutputStream(StringRef Path, StringRef Extension, return errorCodeToError(E); std::error_code E; - raw_ostream *RawStream = new raw_fd_ostream(FullPath, E, sys::fs::F_RW); + raw_ostream *RawStream = + new raw_fd_ostream(FullPath, E, sys::fs::FA_Read | sys::fs::FA_Write); auto OS = CoveragePrinter::OwnedStream(RawStream); if (E) return errorCodeToError(E); diff --git a/llvm/tools/llvm-cov/TestingSupport.cpp b/llvm/tools/llvm-cov/TestingSupport.cpp index 4713d75f17d..e07abdbd17f 100644 --- a/llvm/tools/llvm-cov/TestingSupport.cpp +++ b/llvm/tools/llvm-cov/TestingSupport.cpp @@ -75,8 +75,7 @@ int convertForTestingMain(int argc, const char *argv[]) { return 1; int FD; - if (auto Err = - sys::fs::openFileForWrite(OutputFilename, FD, sys::fs::F_None)) { + if (auto Err = sys::fs::openFileForWrite(OutputFilename, FD)) { errs() << "error: " << Err.message() << "\n"; return 1; } diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp index 9fe7a846353..237a5404daa 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp @@ -258,7 +258,8 @@ InstructionBenchmark::writeYaml(const BenchmarkResultContext &Context, } else { int ResultFD = 0; if (auto E = llvm::errorCodeToError( - openFileForWrite(Filename, ResultFD, llvm::sys::fs::F_Text))) { + openFileForWrite(Filename, ResultFD, llvm::sys::fs::CD_CreateAlways, + llvm::sys::fs::F_Text))) { return E; } llvm::raw_fd_ostream Ostr(ResultFD, true /*shouldClose*/); diff --git a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp index 47f2dd9bebd..bc01d567df1 100644 --- a/llvm/tools/llvm-exegesis/llvm-exegesis.cpp +++ b/llvm/tools/llvm-exegesis/llvm-exegesis.cpp @@ -166,9 +166,12 @@ static void maybeRunAnalysis(const Analysis &Analyzer, const std::string &Name, } std::error_code ErrorCode; llvm::raw_fd_ostream ClustersOS(OutputFilename, ErrorCode, - llvm::sys::fs::F_RW); - ExitOnErr(llvm::errorCodeToError(ErrorCode)); - ExitOnErr(Analyzer.run<Pass>(ClustersOS)); + llvm::sys::fs::FA_Read | + llvm::sys::fs::FA_Write); + if (ErrorCode) + llvm::report_fatal_error("cannot open out file: " + OutputFilename); + if (auto Err = Analyzer.run<Pass>(ClustersOS)) + llvm::report_fatal_error(std::move(Err)); } static void analysisMain() { diff --git a/llvm/tools/llvm-rc/llvm-rc.cpp b/llvm/tools/llvm-rc/llvm-rc.cpp index 41360d2a7bd..0448f4519b4 100644 --- a/llvm/tools/llvm-rc/llvm-rc.cpp +++ b/llvm/tools/llvm-rc/llvm-rc.cpp @@ -171,8 +171,8 @@ int main(int Argc, const char **Argv) { "No more than one output file should be provided (using /FO flag)."); std::error_code EC; - auto FOut = - llvm::make_unique<raw_fd_ostream>(OutArgsInfo[0], EC, sys::fs::F_RW); + auto FOut = llvm::make_unique<raw_fd_ostream>( + OutArgsInfo[0], EC, sys::fs::FA_Read | sys::fs::FA_Write); if (EC) fatalError("Error opening output file '" + OutArgsInfo[0] + "': " + EC.message()); |