diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-26 17:28:04 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-26 17:28:04 +0000 |
commit | e7e4a449ce662d0f14705dde748f3cb55655187e (patch) | |
tree | 4225823156eeb896d8aa65412f1a13aeb16fe443 | |
parent | d077bc6a20962c19af56bcd955e19f728b63aa26 (diff) | |
download | bcm5719-llvm-e7e4a449ce662d0f14705dde748f3cb55655187e.tar.gz bcm5719-llvm-e7e4a449ce662d0f14705dde748f3cb55655187e.zip |
Use enums instead of raw octal values.
Patch by 罗勇刚(Yonggang Luo).
llvm-svn: 184971
-rw-r--r-- | llvm/include/llvm/Support/FileSystem.h | 9 | ||||
-rw-r--r-- | llvm/lib/Support/Unix/PathV2.inc | 1 | ||||
-rw-r--r-- | llvm/tools/llvm-ar/ArchiveWriter.cpp | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/llvm/include/llvm/Support/FileSystem.h b/llvm/include/llvm/Support/FileSystem.h index 558145c246f..b72192753c7 100644 --- a/llvm/include/llvm/Support/FileSystem.h +++ b/llvm/include/llvm/Support/FileSystem.h @@ -111,6 +111,9 @@ enum perms { others_write = 02, others_exe = 01, others_all = others_read | others_write | others_exe, + all_read = owner_read | group_read | others_read, + all_write = owner_write | group_write | others_write, + all_exe = owner_exe | group_exe | others_exe, all_all = owner_all | group_all | others_all, set_uid_on_exe = 04000, set_gid_on_exe = 02000, @@ -559,15 +562,17 @@ error_code status_known(const Twine &path, bool &result); /// @param result_path Set to the opened file's absolute path. /// @param makeAbsolute If true and \a model is not an absolute path, a temp /// directory will be prepended. +/// @param mode Set to the file open mode; since this is most often used for +/// temporary files, mode defaults to owner_read | owner_write. /// @returns errc::success if result_{fd,path} have been successfully set, /// otherwise a platform specific error_code. error_code unique_file(const Twine &model, int &result_fd, SmallVectorImpl<char> &result_path, - bool makeAbsolute = true, unsigned mode = 0600); + bool makeAbsolute = true, unsigned mode = owner_read | owner_write); /// @brief Simpler version for clients that don't want an open file. error_code unique_file(const Twine &Model, SmallVectorImpl<char> &ResultPath, - bool MakeAbsolute = true, unsigned Mode = 0600); + bool MakeAbsolute = true, unsigned Mode = owner_read | owner_write); /// @brief Canonicalize path. /// diff --git a/llvm/lib/Support/Unix/PathV2.inc b/llvm/lib/Support/Unix/PathV2.inc index 29a89b03d07..91efcd80233 100644 --- a/llvm/lib/Support/Unix/PathV2.inc +++ b/llvm/lib/Support/Unix/PathV2.inc @@ -564,7 +564,6 @@ error_code setLastModificationAndAccessTime(int FD, TimeValue Time) { return error_code::success(); } -// Since this is most often used for temporary files, mode defaults to 0600. error_code unique_file(const Twine &model, int &result_fd, SmallVectorImpl<char> &result_path, bool makeAbsolute, unsigned mode) { diff --git a/llvm/tools/llvm-ar/ArchiveWriter.cpp b/llvm/tools/llvm-ar/ArchiveWriter.cpp index 8f010ad7ba8..7dad7e0a472 100644 --- a/llvm/tools/llvm-ar/ArchiveWriter.cpp +++ b/llvm/tools/llvm-ar/ArchiveWriter.cpp @@ -268,7 +268,7 @@ bool Archive::writeToDisk(bool TruncateNames, std::string *ErrMsg) { int TmpArchiveFD; SmallString<128> TmpArchive; error_code EC = sys::fs::unique_file("temp-archive-%%%%%%%.a", TmpArchiveFD, - TmpArchive, true, 0666); + TmpArchive, true, sys::fs::all_read | sys::fs::all_write); if (EC) return true; |