summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJordy Rose <jediknil@belkadan.com>2011-08-17 18:23:17 +0000
committerJordy Rose <jediknil@belkadan.com>2011-08-17 18:23:17 +0000
commite575902c711bc8156ea006f5ed8bbd933a94f3b2 (patch)
tree43b89e206eb52d493af843f173a93b75a88af092 /llvm
parentd40d838cc48b22fdfc24c8f5597e88422e5251db (diff)
downloadbcm5719-llvm-e575902c711bc8156ea006f5ed8bbd933a94f3b2.tar.gz
bcm5719-llvm-e575902c711bc8156ea006f5ed8bbd933a94f3b2.zip
Don't use NULL to represent an invalid library; Cygwin uses this for RTLD_DEFAULT. Caught by Takumi.
llvm-svn: 137841
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Support/DynamicLibrary.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/include/llvm/Support/DynamicLibrary.h b/llvm/include/llvm/Support/DynamicLibrary.h
index 04100cd891a..11965292dd1 100644
--- a/llvm/include/llvm/Support/DynamicLibrary.h
+++ b/llvm/include/llvm/Support/DynamicLibrary.h
@@ -32,13 +32,18 @@ namespace sys {
/// 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.
OpenPOWER on IntegriCloud