diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2004-12-13 17:01:53 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2004-12-13 17:01:53 +0000 |
commit | 9d88d1aaab145e18c8e0fe93544f8a1ff0474866 (patch) | |
tree | 76878e5c34075b7fb47f4cc78dc6636840922da0 /lib | |
parent | 4251ce4b10a35552df67ea624b180ad247960eef (diff) | |
download | external_llvm-9d88d1aaab145e18c8e0fe93544f8a1ff0474866.zip external_llvm-9d88d1aaab145e18c8e0fe93544f8a1ff0474866.tar.gz external_llvm-9d88d1aaab145e18c8e0fe93544f8a1ff0474866.tar.bz2 |
For PR351: \
The getFileTimestamp and getFileSize functions have been removed from \
FileUtilities.{h,cpp}. They are replaced by Path::getTimestamp and \
Path::getSize,respectively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18892 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Debugger/ProgramInfo.cpp | 5 | ||||
-rw-r--r-- | lib/Support/FileUtilities.cpp | 24 |
2 files changed, 6 insertions, 23 deletions
diff --git a/lib/Debugger/ProgramInfo.cpp b/lib/Debugger/ProgramInfo.cpp index c6e5d32..c0d85f9 100644 --- a/lib/Debugger/ProgramInfo.cpp +++ b/lib/Debugger/ProgramInfo.cpp @@ -236,9 +236,10 @@ void SourceFunctionInfo::getSourceLocation(unsigned &RetLineNo, // ProgramInfo implementation // -ProgramInfo::ProgramInfo(Module *m) : M(m) { +ProgramInfo::ProgramInfo(Module *m) : M(m), ProgramTimeStamp(0,0) { assert(M && "Cannot create program information with a null module!"); - ProgramTimeStamp = getFileTimestamp(M->getModuleIdentifier()); + sys::Path modulePath(M->getModuleIdentifier()); + ProgramTimeStamp = modulePath.getTimestamp(); SourceFilesIsComplete = false; SourceFunctionsIsComplete = false; diff --git a/lib/Support/FileUtilities.cpp b/lib/Support/FileUtilities.cpp index 5b7c56e..305f455 100644 --- a/lib/Support/FileUtilities.cpp +++ b/lib/Support/FileUtilities.cpp @@ -14,6 +14,7 @@ #include "llvm/Support/FileUtilities.h" #include "llvm/Support/DataTypes.h" +#include "llvm/System/Path.h" #include "llvm/Config/unistd.h" #include "llvm/Config/fcntl.h" #include "llvm/Config/sys/types.h" @@ -195,26 +196,6 @@ bool llvm::MakeFileReadable(const std::string &Filename) { return AddPermissionsBits(Filename, 0444); } -/// getFileSize - Return the size of the specified file in bytes, or -1 if the -/// file cannot be read or does not exist. -long long llvm::getFileSize(const std::string &Filename) { - struct stat StatBuf; - if (stat(Filename.c_str(), &StatBuf) == -1) - return -1; - return StatBuf.st_size; -} - -/// getFileTimestamp - Get the last modified time for the specified file in an -/// unspecified format. This is useful to allow checking to see if a file was -/// updated since that last time the timestampt was aquired. If the file does -/// not exist or there is an error getting the time-stamp, zero is returned. -unsigned long long llvm::getFileTimestamp(const std::string &Filename) { - struct stat StatBuf; - if (stat(Filename.c_str(), &StatBuf) == -1) - return 0; - return StatBuf.st_mtime; -} - /// ReadFileIntoAddressSpace - Attempt to map the specific file into the /// address space of the current process for reading. If this succeeds, /// return the address of the buffer and the length of the file mapped. On @@ -222,7 +203,8 @@ unsigned long long llvm::getFileTimestamp(const std::string &Filename) { void *llvm::ReadFileIntoAddressSpace(const std::string &Filename, unsigned &Length) { #if defined(HAVE_MMAP_FILE) && !defined(_MSC_VER) - Length = (unsigned)getFileSize(Filename); + sys::Path File(Filename); + Length = (unsigned)File.getSize(); if ((int)Length == -1) return 0; FDHandle FD(open(Filename.c_str(), O_RDONLY)); |