[llvm-commits] [llvm] r120991 - in /llvm/trunk/lib/Support/Windows: PathV2.inc Windows.h

Michael J. Spencer bigcheesegs at gmail.com
Sun Dec 5 22:02:07 PST 2010


Author: mspencer
Date: Mon Dec  6 00:02:07 2010
New Revision: 120991

URL: http://llvm.org/viewvc/llvm-project?rev=120991&view=rev
Log:
Support/Windows: Make MinGW happy.

Modified:
    llvm/trunk/lib/Support/Windows/PathV2.inc
    llvm/trunk/lib/Support/Windows/Windows.h

Modified: llvm/trunk/lib/Support/Windows/PathV2.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/PathV2.inc?rev=120991&r1=120990&r2=120991&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/PathV2.inc (original)
+++ llvm/trunk/lib/Support/Windows/PathV2.inc Mon Dec  6 00:02:07 2010
@@ -118,7 +118,7 @@
     return ::CryptReleaseContext(Provider, 0);
   }
 
-  typedef ScopedHandle<HCRYPTPROV, HCRYPTPROV(INVALID_HANDLE_VALUE),
+  typedef ScopedHandle<HCRYPTPROV, uintptr_t(-1),
                        BOOL (WINAPI*)(HCRYPTPROV), CryptReleaseContext>
     ScopedCryptContext;
   bool is_separator(const wchar_t value) {

Modified: llvm/trunk/lib/Support/Windows/Windows.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Windows.h?rev=120991&r1=120990&r2=120991&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Windows.h (original)
+++ llvm/trunk/lib/Support/Windows/Windows.h Mon Dec  6 00:02:07 2010
@@ -59,7 +59,7 @@
   }
 };
 
-template <class HandleType, HandleType InvalidHandle,
+template <class HandleType, uintptr_t InvalidHandle,
           class DeleterType, DeleterType D>
 class ScopedHandle {
   HandleType Handle;
@@ -69,13 +69,13 @@
   ScopedHandle(HandleType handle) : Handle(handle) {}
 
   ~ScopedHandle() {
-    if (Handle != InvalidHandle)
+    if (Handle != HandleType(InvalidHandle))
       D(Handle);
   }
 
   HandleType take() {
     HandleType temp = Handle;
-    Handle = InvalidHandle;
+    Handle = HandleType(InvalidHandle);
     return temp;
   }
 
@@ -91,14 +91,14 @@
 
   // True if Handle is valid.
   operator unspecified_bool_type() const {
-    return Handle == InvalidHandle ? 0 : unspecified_bool_true;
+    return Handle == HandleType(InvalidHandle) ? 0 : unspecified_bool_true;
   }
 
   bool operator!() const {
-    return Handle == InvalidHandle;
+    return Handle == HandleType(InvalidHandle);
   }
 };
 
-typedef ScopedHandle<HANDLE, INVALID_HANDLE_VALUE,
+typedef ScopedHandle<HANDLE, uintptr_t(-1),
                       BOOL (WINAPI*)(HANDLE), ::FindClose>
   ScopedFindHandle;





More information about the llvm-commits mailing list