[llvm-commits] CVS: llvm/tools/llvm-link/llvm-link.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Dec 30 01:49:01 PST 2003


Changes in directory llvm/tools/llvm-link:

llvm-link.cpp updated: 1.33 -> 1.34

---
Log message:

Use getFileSize() instead of sys/stat.h directly


---
Diffs of the changes:  (+2 -9)

Index: llvm/tools/llvm-link/llvm-link.cpp
diff -u llvm/tools/llvm-link/llvm-link.cpp:1.33 llvm/tools/llvm-link/llvm-link.cpp:1.34
--- llvm/tools/llvm-link/llvm-link.cpp:1.33	Tue Nov 11 16:41:34 2003
+++ llvm/tools/llvm-link/llvm-link.cpp	Tue Dec 30 01:48:17 2003
@@ -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 @@
 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 @@
 
   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!
 





More information about the llvm-commits mailing list