Use const ref instead of value for Twine in the disk_space() API

Thanks Rui for noticing!

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265074 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mehdi Amini 2016-03-31 23:14:45 +00:00
parent 44f51d9b56
commit 3ddee86990
3 changed files with 3 additions and 3 deletions

View File

@ -658,7 +658,7 @@ std::error_code getUniqueID(const Twine Path, UniqueID &Result);
/// @returns a space_info structure filled with the capacity, free, and
/// available space on the device \a Path is on. A platform specific error_code
/// is returned on error.
ErrorOr<space_info> disk_space(const Twine Path);
ErrorOr<space_info> disk_space(const Twine &Path);
/// This class represents a memory mapped file. It is based on
/// boost::iostreams::mapped_file.

View File

@ -208,7 +208,7 @@ UniqueID file_status::getUniqueID() const {
return UniqueID(fs_st_dev, fs_st_ino);
}
ErrorOr<space_info> disk_space(const Twine Path) {
ErrorOr<space_info> disk_space(const Twine &Path) {
struct STATVFS Vfs;
if (::STATVFS(Path.str().c_str(), &Vfs))
return std::error_code(errno, std::generic_category());

View File

@ -151,7 +151,7 @@ UniqueID file_status::getUniqueID() const {
return UniqueID(VolumeSerialNumber, FileID);
}
ErrorOr<space_info> disk_space(const Twine Path) {
ErrorOr<space_info> disk_space(const Twine &Path) {
PULARGE_INTEGER Avail, Total, Free;
if (!::GetDiskFreeSpaceExA(Path.str().c_str(), &Avail, &Total, &Free))
return mapWindowsError(::GetLastError());