[llvm-commits] [llvm] r137841 - /llvm/trunk/include/llvm/Support/DynamicLibrary.h
Jordy Rose
jediknil at belkadan.com
Wed Aug 17 11:23:17 PDT 2011
Author: jrose
Date: Wed Aug 17 13:23:17 2011
New Revision: 137841
URL: http://llvm.org/viewvc/llvm-project?rev=137841&view=rev
Log:
Don't use NULL to represent an invalid library; Cygwin uses this for RTLD_DEFAULT. Caught by Takumi.
Modified:
llvm/trunk/include/llvm/Support/DynamicLibrary.h
Modified: llvm/trunk/include/llvm/Support/DynamicLibrary.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DynamicLibrary.h?rev=137841&r1=137840&r2=137841&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/DynamicLibrary.h (original)
+++ llvm/trunk/include/llvm/Support/DynamicLibrary.h Wed Aug 17 13:23:17 2011
@@ -32,13 +32,18 @@
/// Note: there is currently no interface for temporarily loading a library,
/// or for unloading libraries when the LLVM library is unloaded.
class DynamicLibrary {
+ // Placeholder whose address represents an invalid library.
+ // We use this instead of NULL or a pointer-int pair because the OS library
+ // might define 0 or 1 to be "special" handles, such as "search all".
+ static const char Invalid;
+
// Opaque data used to interface with OS-specific dynamic library handling.
void *Data;
- explicit DynamicLibrary(void *data = 0) : Data(data) {}
+ explicit DynamicLibrary(void *data = &Invalid) : Data(data) {}
public:
/// Returns true if the object refers to a valid library.
- bool isValid() { return Data != 0; }
+ bool isValid() { return Data != &Invalid; }
/// Searches through the library for the symbol \p symbolName. If it is
/// found, the address of that symbol is returned. If not, NULL is returned.
More information about the llvm-commits
mailing list