mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
Simplify remove, create_directory and create_directories.
Before this patch they would take an boolean argument to say if the path already existed. This was redundant with the returned error_code which is able to represent that. This allowed for callers to incorrectly check only the existed flag instead of first checking the error code. Instead, pass in a boolean flag to say if the previous (non-)existence should be an error or not. Callers of the of the old simple versions are not affected. They still ignore the previous (non-)existence as they did before. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201979 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -751,12 +751,12 @@ error_code make_absolute(SmallVectorImpl<char> &path) {
|
||||
"occurred above!");
|
||||
}
|
||||
|
||||
error_code create_directories(const Twine &Path, bool &Existed) {
|
||||
error_code create_directories(const Twine &Path, bool IgnoreExisting) {
|
||||
SmallString<128> PathStorage;
|
||||
StringRef P = Path.toStringRef(PathStorage);
|
||||
|
||||
// Be optimistic and try to create the directory
|
||||
error_code EC = create_directory(P, Existed);
|
||||
error_code EC = create_directory(P, IgnoreExisting);
|
||||
// If we succeeded, or had any error other than the parent not existing, just
|
||||
// return it.
|
||||
if (EC != errc::no_such_file_or_directory)
|
||||
@ -771,7 +771,7 @@ error_code create_directories(const Twine &Path, bool &Existed) {
|
||||
if ((EC = create_directories(Parent)))
|
||||
return EC;
|
||||
|
||||
return create_directory(P, Existed);
|
||||
return create_directory(P, IgnoreExisting);
|
||||
}
|
||||
|
||||
bool exists(file_status status) {
|
||||
|
Reference in New Issue
Block a user