mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-08 04:11:27 +00:00
Simplify a few uses of remove_filename by using parent_path instead.
llvm-svn: 242334
This commit is contained in:
parent
ef1c11128f
commit
afc94ffbf8
@ -122,9 +122,8 @@ ErrorOr<StringRef> Archive::Child::getBuffer() const {
|
|||||||
ErrorOr<StringRef> Name = getName();
|
ErrorOr<StringRef> Name = getName();
|
||||||
if (std::error_code EC = Name.getError())
|
if (std::error_code EC = Name.getError())
|
||||||
return EC;
|
return EC;
|
||||||
SmallString<128> FullName =
|
SmallString<128> FullName = sys::path::parent_path(
|
||||||
Parent->getMemoryBufferRef().getBufferIdentifier();
|
Parent->getMemoryBufferRef().getBufferIdentifier());
|
||||||
sys::path::remove_filename(FullName);
|
|
||||||
sys::path::append(FullName, *Name);
|
sys::path::append(FullName, *Name);
|
||||||
ErrorOr<std::unique_ptr<MemoryBuffer>> Buf = MemoryBuffer::getFile(FullName);
|
ErrorOr<std::unique_ptr<MemoryBuffer>> Buf = MemoryBuffer::getFile(FullName);
|
||||||
if (std::error_code EC = Buf.getError())
|
if (std::error_code EC = Buf.getError())
|
||||||
|
@ -889,8 +889,7 @@ std::error_code is_other(const Twine &Path, bool &Result) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void directory_entry::replace_filename(const Twine &filename, file_status st) {
|
void directory_entry::replace_filename(const Twine &filename, file_status st) {
|
||||||
SmallString<128> path(Path.begin(), Path.end());
|
SmallString<128> path = path::parent_path(Path);
|
||||||
path::remove_filename(path);
|
|
||||||
path::append(path, filename);
|
path::append(path, filename);
|
||||||
Path = path.str();
|
Path = path.str();
|
||||||
Status = st;
|
Status = st;
|
||||||
|
@ -262,8 +262,7 @@ public:
|
|||||||
if (!getCacheFilename(ModuleID, CacheName))
|
if (!getCacheFilename(ModuleID, CacheName))
|
||||||
return;
|
return;
|
||||||
if (!CacheDir.empty()) { // Create user-defined cache dir.
|
if (!CacheDir.empty()) { // Create user-defined cache dir.
|
||||||
SmallString<128> dir(CacheName);
|
SmallString<128> dir(sys::path::parent_path(CacheName));
|
||||||
sys::path::remove_filename(dir);
|
|
||||||
sys::fs::create_directories(Twine(dir));
|
sys::fs::create_directories(Twine(dir));
|
||||||
}
|
}
|
||||||
std::error_code EC;
|
std::error_code EC;
|
||||||
|
Loading…
Reference in New Issue
Block a user