summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-12-30 07:36:14 +0000
committerChris Lattner <sabre@nondot.org>2003-12-30 07:36:14 +0000
commit4a1c74dcf84c4129d20b646926b32083f117ee96 (patch)
tree8f924382f09ebf2782380206549e0732b0751ca0 /llvm/lib/Support
parent419b70539b5c5c323319fdeec19be449ede763c1 (diff)
downloadbcm5719-llvm-4a1c74dcf84c4129d20b646926b32083f117ee96.tar.gz
bcm5719-llvm-4a1c74dcf84c4129d20b646926b32083f117ee96.zip
Add new method
llvm-svn: 10649
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/FileUtilities.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Support/FileUtilities.cpp b/llvm/lib/Support/FileUtilities.cpp
index 9471710b1d5..04b8c610a27 100644
--- a/llvm/lib/Support/FileUtilities.cpp
+++ b/llvm/lib/Support/FileUtilities.cpp
@@ -195,6 +195,16 @@ 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;
+}
+
+
//===----------------------------------------------------------------------===//
// FDHandle class implementation
//
OpenPOWER on IntegriCloud