[llvm] r216571 - Fix some semantic usability issues with DynamicLibrary.

Zachary Turner zturner at google.com
Wed Aug 27 11:13:26 PDT 2014


Author: zturner
Date: Wed Aug 27 13:13:25 2014
New Revision: 216571

URL: http://llvm.org/viewvc/llvm-project?rev=216571&view=rev
Log:
Fix some semantic usability issues with DynamicLibrary.

This patch allows invalid DynamicLibrary instances to be
constructed, and fixes the const-correctness of the isValid()
method.

No functional change.

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=216571&r1=216570&r2=216571&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/DynamicLibrary.h (original)
+++ llvm/trunk/include/llvm/Support/DynamicLibrary.h Wed Aug 27 13:13:25 2014
@@ -43,10 +43,11 @@ namespace sys {
     // Opaque data used to interface with OS-specific dynamic library handling.
     void *Data;
 
-    explicit DynamicLibrary(void *data = &Invalid) : Data(data) {}
   public:
+    explicit DynamicLibrary(void *data = &Invalid) : Data(data) {}
+
     /// Returns true if the object refers to a valid library.
-    bool isValid() { return Data != &Invalid; }
+    bool isValid() const { 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