summaryrefslogtreecommitdiff
path: root/tools/llvm-link
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-12-30 07:48:17 +0000
committerChris Lattner <sabre@nondot.org>2003-12-30 07:48:17 +0000
commitb74f4d042248805988b953b815453422767b292e (patch)
tree77a2ed9280bb3c8fb67d3a2257d893629f6203cb /tools/llvm-link
parent97f752f6d501f507b5ed433a28f8e6f09cbe5170 (diff)
downloadllvm-b74f4d042248805988b953b815453422767b292e.tar.gz
llvm-b74f4d042248805988b953b815453422767b292e.tar.bz2
llvm-b74f4d042248805988b953b815453422767b292e.tar.xz
Use getFileSize() instead of sys/stat.h directly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10652 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-link')
-rw-r--r--tools/llvm-link/llvm-link.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index 3b49214516..1b3dda790d 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -18,11 +18,10 @@
#include "llvm/Bytecode/Writer.h"
#include "llvm/Transforms/Utils/Linker.h"
#include "Support/CommandLine.h"
+#include "Support/FileUtilities.h"
#include "Support/Signals.h"
#include <fstream>
#include <memory>
-#include <sys/types.h> // For FileExists
-#include <sys/stat.h>
using namespace llvm;
@@ -46,12 +45,6 @@ static cl::list<std::string>
LibPaths("L", cl::desc("Specify a library search path"), cl::ZeroOrMore,
cl::value_desc("directory"), cl::Prefix);
-// FileExists - Return true if the specified string is an openable file...
-static inline bool FileExists(const std::string &FN) {
- struct stat StatBuf;
- return stat(FN.c_str(), &StatBuf) != -1;
-}
-
// LoadFile - Read the specified bytecode file in and return it. This routine
// searches the link path for the specified file to try to find it...
//
@@ -64,7 +57,7 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
while (1) {
if (Verbose) std::cerr << "Loading '" << Filename << "'\n";
- if (FileExists(Filename)) FoundAFile = true;
+ if (getFileSize(Filename) != -1) FoundAFile = true;
Module *Result = ParseBytecodeFile(Filename, &ErrorMessage);
if (Result) return std::auto_ptr<Module>(Result); // Load successful!