[llvm] r265074 - Use const ref instead of value for Twine in the disk_space() API

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 16:14:45 PDT 2016


Author: mehdi_amini
Date: Thu Mar 31 18:14:45 2016
New Revision: 265074

URL: http://llvm.org/viewvc/llvm-project?rev=265074&view=rev
Log:
Use const ref instead of value for Twine in the disk_space() API

Thanks Rui for noticing!

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

Modified:
    llvm/trunk/include/llvm/Support/FileSystem.h
    llvm/trunk/lib/Support/Unix/Path.inc
    llvm/trunk/lib/Support/Windows/Path.inc

Modified: llvm/trunk/include/llvm/Support/FileSystem.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=265074&r1=265073&r2=265074&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/FileSystem.h (original)
+++ llvm/trunk/include/llvm/Support/FileSystem.h Thu Mar 31 18:14:45 2016
@@ -658,7 +658,7 @@ std::error_code getUniqueID(const Twine
 /// @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.

Modified: llvm/trunk/lib/Support/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=265074&r1=265073&r2=265074&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Path.inc (original)
+++ llvm/trunk/lib/Support/Unix/Path.inc Thu Mar 31 18:14:45 2016
@@ -208,7 +208,7 @@ UniqueID file_status::getUniqueID() cons
   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());

Modified: llvm/trunk/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=265074&r1=265073&r2=265074&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Path.inc (original)
+++ llvm/trunk/lib/Support/Windows/Path.inc Thu Mar 31 18:14:45 2016
@@ -151,7 +151,7 @@ UniqueID file_status::getUniqueID() cons
   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());




More information about the llvm-commits mailing list