[llvm-commits] CVS: llvm/lib/System/Win32/Path.inc

Chris Lattner lattner at cs.uiuc.edu
Tue Aug 1 10:51:25 PDT 2006



Changes in directory llvm/lib/System/Win32:

Path.inc updated: 1.49 -> 1.50
---
Log message:

elimiante some syscalls


---
Diffs of the changes:  (+8 -8)

 Path.inc |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/lib/System/Win32/Path.inc
diff -u llvm/lib/System/Win32/Path.inc:1.49 llvm/lib/System/Win32/Path.inc:1.50
--- llvm/lib/System/Win32/Path.inc:1.49	Tue Aug  1 03:07:22 2006
+++ llvm/lib/System/Win32/Path.inc	Tue Aug  1 12:51:09 2006
@@ -281,8 +281,6 @@
 
 bool
 Path::isBytecodeFile() const {
-  if (!isFile())
-    return false;
   std::string actualMagic;
   if (!getMagicNumber(actualMagic, 4))
     return false;
@@ -574,12 +572,16 @@
 
 bool
 Path::eraseFromDisk(bool remove_contents, std::string *ErrStr) const {
-  if (isFile()) {
+  FileStatus Status;
+  if (getFileStatus(Status, ErrStr))
+    return true;
+    
+  if (Status.isFile) {
     DWORD attr = GetFileAttributes(path.c_str());
 
     // If it doesn't exist, we're done.
     if (attr == INVALID_FILE_ATTRIBUTES)
-      return false;
+      return true;
 
     // Read-only files cannot be deleted on Windows.  Must remove the read-only
     // attribute first.
@@ -590,8 +592,8 @@
 
     if (!DeleteFile(path.c_str()))
       ThrowError(path + ": Can't destroy file: ");
-    return true;
-  } else if (isDirectory()) {
+    return false;
+  } else if (Status.isDir) {
     // If it doesn't exist, we're done.
     if (!exists())
       return false;
@@ -657,8 +659,6 @@
 }
 
 bool Path::getMagicNumber(std::string& Magic, unsigned len) const {
-  if (!isFile())
-    return false;
   assert(len < 1024 && "Request for magic string too long");
   char* buf = (char*) alloca(1 + len);
 






More information about the llvm-commits mailing list