From 31127e1d89efe440d761497f29dbe646b23a2806 Mon Sep 17 00:00:00 2001 From: Jeff Cohen Date: Thu, 9 Dec 2004 05:51:11 +0000 Subject: [PATCH] Fix residual Visual Studio build problems git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18688 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/DataTypes.h.in | 1 + lib/System/Win32/DynamicLibrary.cpp | 18 +++++++----------- lib/System/Win32/DynamicLibrary.inc | 18 +++++++----------- win32/Transforms/Transforms.vcproj | 3 --- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/include/llvm/Support/DataTypes.h.in b/include/llvm/Support/DataTypes.h.in index d5d1fc697af..4290ae60958 100644 --- a/include/llvm/Support/DataTypes.h.in +++ b/include/llvm/Support/DataTypes.h.in @@ -66,6 +66,7 @@ typedef u_int64_t uint64_t; #else /* _MSC_VER */ // Visual C++ doesn't provide standard integer headers, but it does provide // built-in data types. +#include typedef __int64 int64_t; typedef unsigned __int64 uint64_t; typedef signed int int32_t; diff --git a/lib/System/Win32/DynamicLibrary.cpp b/lib/System/Win32/DynamicLibrary.cpp index d743454746a..cc3376eedf9 100644 --- a/lib/System/Win32/DynamicLibrary.cpp +++ b/lib/System/Win32/DynamicLibrary.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "Win32.h" -#include namespace llvm { using namespace sys; @@ -23,33 +22,30 @@ using namespace sys; //===----------------------------------------------------------------------===// DynamicLibrary::DynamicLibrary() : handle(0) { - handle = new HMODULE; - *((HMODULE*)handle) = GetModuleHandle(NULL); + handle = (void*) GetModuleHandle(NULL); - if (*((HMODULE*)handle) == 0) { + if (handle == 0) { ThrowError("Can't GetModuleHandle: "); } } DynamicLibrary::DynamicLibrary(const char*filename) : handle(0) { - handle = new HMODULE; - *((HMODULE*)handle) = LoadLibrary(filename); + handle = LoadLibrary(filename); - if (*((HMODULE*)handle) == 0) { + if (handle == 0) { ThrowError("Can't LoadLibrary: "); } } DynamicLibrary::~DynamicLibrary() { assert(handle !=0 && "Invalid DynamicLibrary handle"); - if (*((HMODULE*)handle)) - FreeLibrary(*((HMODULE*)handle)); - delete (HMODULE*)handle; + if (handle) + FreeLibrary((HMODULE*)handle); } void *DynamicLibrary::GetAddressOfSymbol(const char *symbolName) { assert(handle !=0 && "Invalid DynamicLibrary handle"); - return (void*) GetProcAddress(*((HMODULE*)handle), symbolName); + return (void*) GetProcAddress((HMODULE*)handle, symbolName); } } diff --git a/lib/System/Win32/DynamicLibrary.inc b/lib/System/Win32/DynamicLibrary.inc index d743454746a..cc3376eedf9 100644 --- a/lib/System/Win32/DynamicLibrary.inc +++ b/lib/System/Win32/DynamicLibrary.inc @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "Win32.h" -#include namespace llvm { using namespace sys; @@ -23,33 +22,30 @@ using namespace sys; //===----------------------------------------------------------------------===// DynamicLibrary::DynamicLibrary() : handle(0) { - handle = new HMODULE; - *((HMODULE*)handle) = GetModuleHandle(NULL); + handle = (void*) GetModuleHandle(NULL); - if (*((HMODULE*)handle) == 0) { + if (handle == 0) { ThrowError("Can't GetModuleHandle: "); } } DynamicLibrary::DynamicLibrary(const char*filename) : handle(0) { - handle = new HMODULE; - *((HMODULE*)handle) = LoadLibrary(filename); + handle = LoadLibrary(filename); - if (*((HMODULE*)handle) == 0) { + if (handle == 0) { ThrowError("Can't LoadLibrary: "); } } DynamicLibrary::~DynamicLibrary() { assert(handle !=0 && "Invalid DynamicLibrary handle"); - if (*((HMODULE*)handle)) - FreeLibrary(*((HMODULE*)handle)); - delete (HMODULE*)handle; + if (handle) + FreeLibrary((HMODULE*)handle); } void *DynamicLibrary::GetAddressOfSymbol(const char *symbolName) { assert(handle !=0 && "Invalid DynamicLibrary handle"); - return (void*) GetProcAddress(*((HMODULE*)handle), symbolName); + return (void*) GetProcAddress((HMODULE*)handle, symbolName); } } diff --git a/win32/Transforms/Transforms.vcproj b/win32/Transforms/Transforms.vcproj index 8308497280c..d9685f2b1de 100644 --- a/win32/Transforms/Transforms.vcproj +++ b/win32/Transforms/Transforms.vcproj @@ -310,9 +310,6 @@ - -