X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FSupport%2FDynamicLibrary.h;h=0f59cbf23947d132f26804c2e5b410a0ef63854b;hb=a5bf44b0b396e8b9ae0db5c62c05ac6618aab5d3;hp=04100cd891ae7ba83527cc5ee59f1ccf3b405a98;hpb=0bce85fbfacec97255337d12fc0ab193f03f21c3;p=oota-llvm.git diff --git a/include/llvm/Support/DynamicLibrary.h b/include/llvm/Support/DynamicLibrary.h index 04100cd891a..0f59cbf2394 100644 --- a/include/llvm/Support/DynamicLibrary.h +++ b/include/llvm/Support/DynamicLibrary.h @@ -17,6 +17,9 @@ #include namespace llvm { + +class StringRef; + namespace sys { /// This class provides a portable interface to dynamic libraries which also @@ -32,13 +35,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 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.