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

Reid Spencer reid at x10sys.com
Wed Aug 23 00:31:08 PDT 2006



Changes in directory llvm/lib/System/Win32:

Path.inc updated: 1.54 -> 1.55
Win32.h updated: 1.7 -> 1.8
---
Log message:

For PR797: http://llvm.org/PR797 :
Eliminate exception throwing from Path::renamePathOnDisk and adjust its 
users correspondingly.


---
Diffs of the changes:  (+6 -5)

 Path.inc |    6 +++---
 Win32.h  |    5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)


Index: llvm/lib/System/Win32/Path.inc
diff -u llvm/lib/System/Win32/Path.inc:1.54 llvm/lib/System/Win32/Path.inc:1.55
--- llvm/lib/System/Win32/Path.inc:1.54	Wed Aug 23 01:56:27 2006
+++ llvm/lib/System/Win32/Path.inc	Wed Aug 23 02:30:48 2006
@@ -651,10 +651,10 @@
 }
 
 bool
-Path::renamePathOnDisk(const Path& newName) {
+Path::renamePathOnDisk(const Path& newName, std::string* ErrMsg) {
   if (!MoveFileEx(path.c_str(), newName.c_str(), MOVEFILE_REPLACE_EXISTING))
-    ThrowError("Can't move '" + path +
-               "' to '" + newName.path + "': ");
+    return MakeErrMsg(ErrMsg, "Can't move '" + path + "' to '" + newName.path 
+        + "': ");
   return true;
 }
 


Index: llvm/lib/System/Win32/Win32.h
diff -u llvm/lib/System/Win32/Win32.h:1.7 llvm/lib/System/Win32/Win32.h:1.8
--- llvm/lib/System/Win32/Win32.h:1.7	Mon Aug 21 01:02:44 2006
+++ llvm/lib/System/Win32/Win32.h	Wed Aug 23 02:30:48 2006
@@ -44,14 +44,15 @@
   throw s;
 }
 
-inline void MakeErrMsg(std::string* ErrMsg, const std::string& prefix) {
+inline bool MakeErrMsg(std::string* ErrMsg, const std::string& prefix) {
   if (!ErrMsg)
-    return;
+    return true;
   char *buffer = NULL;
   FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
       NULL, GetLastError(), 0, (LPSTR)&buffer, 1, NULL);
   ErrMsg = prefix + buffer;
   LocalFree(buffer);
+  return true;
 }
 
 inline void ThrowErrno(const std::string& prefix) {






More information about the llvm-commits mailing list