[llvm-commits] CVS: llvm/lib/Support/FileUtilities.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Dec 30 01:37:00 PST 2003
Changes in directory llvm/lib/Support:
FileUtilities.cpp updated: 1.17 -> 1.18
---
Log message:
Add new method
---
Diffs of the changes: (+10 -0)
Index: llvm/lib/Support/FileUtilities.cpp
diff -u llvm/lib/Support/FileUtilities.cpp:1.17 llvm/lib/Support/FileUtilities.cpp:1.18
--- llvm/lib/Support/FileUtilities.cpp:1.17 Mon Dec 29 20:45:16 2003
+++ llvm/lib/Support/FileUtilities.cpp Tue Dec 30 01:36:14 2003
@@ -195,6 +195,16 @@
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
//
More information about the llvm-commits
mailing list