Insert a sanity check on the combining of x86 truncing-store nodes. This comes to...
[oota-llvm.git] / lib / Support / DynamicLibrary.cpp
index 63298b99a0c987c1fb6f1bad31cb8aadbb7a03fb..fb02c07e4af81e81221d720289ed6ea2061b9144 100644 (file)
@@ -50,6 +50,8 @@ void llvm::sys::DynamicLibrary::AddSymbol(StringRef symbolName,
   (*ExplicitSymbols)[symbolName] = symbolValue;
 }
 
+char llvm::sys::DynamicLibrary::Invalid = 0;
+
 #ifdef LLVM_ON_WIN32
 
 #include "Windows/DynamicLibrary.inc"
@@ -70,6 +72,8 @@ static DenseSet<void *> *OpenedHandles = 0;
 
 DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename,
                                                    std::string *errMsg) {
+  SmartScopedLock<true> lock(getMutex());
+
   void *handle = dlopen(filename, RTLD_LAZY|RTLD_GLOBAL);
   if (handle == 0) {
     if (errMsg) *errMsg = dlerror();
@@ -83,7 +87,6 @@ DynamicLibrary DynamicLibrary::getPermanentLibrary(const char *filename,
     handle = RTLD_DEFAULT;
 #endif
 
-  SmartScopedLock<true> lock(getMutex());
   if (OpenedHandles == 0)
     OpenedHandles = new DenseSet<void *>();