Have scoped mutexes take referenes instead of pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74931 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Support/Annotation.cpp b/lib/Support/Annotation.cpp
index 4b5b97e..9f76256 100644
--- a/lib/Support/Annotation.cpp
+++ b/lib/Support/Annotation.cpp
@@ -55,7 +55,7 @@
 }
 
 static void eraseFromFactMap(unsigned ID) {
-  sys::SmartScopedWriter<true> Writer(&*AnnotationsLock);
+  sys::SmartScopedWriter<true> Writer(*AnnotationsLock);
   TheFactMap->erase(ID);
 }
 
@@ -66,7 +66,7 @@
   AnnotationsLock->reader_release();
   
   if (I == E) {
-    sys::SmartScopedWriter<true> Writer(&*AnnotationsLock);
+    sys::SmartScopedWriter<true> Writer(*AnnotationsLock);
     I = IDMap->find(Name);
     if (I == IDMap->end()) {
       unsigned newCount = sys::AtomicIncrement(&IDCounter);
@@ -91,7 +91,7 @@
 // only be used for debugging.
 //
 const char *AnnotationManager::getName(AnnotationID ID) {  // ID -> Name
-  sys::SmartScopedReader<true> Reader(&*AnnotationsLock);
+  sys::SmartScopedReader<true> Reader(*AnnotationsLock);
   IDMapType &TheMap = *IDMap;
   for (IDMapType::iterator I = TheMap.begin(); ; ++I) {
     assert(I != TheMap.end() && "Annotation ID is unknown!");
@@ -106,7 +106,7 @@
 void AnnotationManager::registerAnnotationFactory(AnnotationID ID, AnnFactory F,
                                                   void *ExtraData) {
   if (F) {
-    sys::SmartScopedWriter<true> Writer(&*AnnotationsLock);
+    sys::SmartScopedWriter<true> Writer(*AnnotationsLock);
     getFactMap()[ID.ID] = std::make_pair(F, ExtraData);
   } else {
     eraseFromFactMap(ID.ID);
diff --git a/lib/Support/PluginLoader.cpp b/lib/Support/PluginLoader.cpp
index ef32af4..ea191ad 100644
--- a/lib/Support/PluginLoader.cpp
+++ b/lib/Support/PluginLoader.cpp
@@ -25,7 +25,7 @@
 static ManagedStatic<sys::SmartMutex<true> > PluginsLock;
 
 void PluginLoader::operator=(const std::string &Filename) {
-  sys::SmartScopedLock<true> Lock(&*PluginsLock);
+  sys::SmartScopedLock<true> Lock(*PluginsLock);
   std::string Error;
   if (sys::DynamicLibrary::LoadLibraryPermanently(Filename.c_str(), &Error)) {
     cerr << "Error opening '" << Filename << "': " << Error
@@ -36,12 +36,12 @@
 }
 
 unsigned PluginLoader::getNumPlugins() {
-  sys::SmartScopedLock<true> Lock(&*PluginsLock);
+  sys::SmartScopedLock<true> Lock(*PluginsLock);
   return Plugins.isConstructed() ? Plugins->size() : 0;
 }
 
 std::string &PluginLoader::getPlugin(unsigned num) {
-  sys::SmartScopedLock<true> Lock(&*PluginsLock);
+  sys::SmartScopedLock<true> Lock(*PluginsLock);
   assert(Plugins.isConstructed() && num < Plugins->size() &&
          "Asking for an out of bounds plugin");
   return (*Plugins)[num];
diff --git a/lib/Support/Statistic.cpp b/lib/Support/Statistic.cpp
index 33570b0..06496fa 100644
--- a/lib/Support/Statistic.cpp
+++ b/lib/Support/Statistic.cpp
@@ -65,7 +65,7 @@
 void Statistic::RegisterStatistic() {
   // If stats are enabled, inform StatInfo that this statistic should be
   // printed.
-  sys::ScopedLock Writer(&*StatLock);
+  sys::ScopedLock Writer(*StatLock);
   if (!Initialized) {
     if (Enabled)
       StatInfo->addStatistic(this);
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp
index ede1dc9..8eef2bd 100644
--- a/lib/Support/Timer.cpp
+++ b/lib/Support/Timer.cpp
@@ -145,7 +145,7 @@
 static ManagedStatic<std::vector<Timer*> > ActiveTimers;
 
 void Timer::startTimer() {
-  sys::SmartScopedLock<true> L(&Lock);
+  sys::SmartScopedLock<true> L(Lock);
   Started = true;
   ActiveTimers->push_back(this);
   TimeRecord TR = getTimeRecord(true);
@@ -157,7 +157,7 @@
 }
 
 void Timer::stopTimer() {
-  sys::SmartScopedLock<true> L(&Lock);
+  sys::SmartScopedLock<true> L(Lock);
   TimeRecord TR = getTimeRecord(false);
   Elapsed    += TR.Elapsed;
   UserTime   += TR.UserTime;
@@ -229,7 +229,7 @@
 static ManagedStatic<Name2Pair> NamedGroupedTimers;
 
 static Timer &getNamedRegionTimer(const std::string &Name) {
-  sys::SmartScopedLock<true> L(&*TimerLock);
+  sys::SmartScopedLock<true> L(*TimerLock);
   Name2Timer::iterator I = NamedTimers->find(Name);
   if (I != NamedTimers->end())
     return I->second;
@@ -239,7 +239,7 @@
 
 static Timer &getNamedRegionTimer(const std::string &Name,
                                   const std::string &GroupName) {
-  sys::SmartScopedLock<true> L(&*TimerLock);
+  sys::SmartScopedLock<true> L(*TimerLock);
 
   Name2Pair::iterator I = NamedGroupedTimers->find(GroupName);
   if (I == NamedGroupedTimers->end()) {
@@ -365,7 +365,7 @@
 
 
 void TimerGroup::removeTimer() {
-  sys::SmartScopedLock<true> L(&*TimerLock);
+  sys::SmartScopedLock<true> L(*TimerLock);
   if (--NumTimers == 0 && !TimersToPrint.empty()) { // Print timing report...
     // Sort the timers in descending order by amount of time taken...
     std::sort(TimersToPrint.begin(), TimersToPrint.end(),
@@ -434,12 +434,12 @@
 }
 
 void TimerGroup::addTimer() {
-  sys::SmartScopedLock<true> L(&*TimerLock);
+  sys::SmartScopedLock<true> L(*TimerLock);
   ++NumTimers;
 }
 
 void TimerGroup::addTimerToPrint(const Timer &T) {
-  sys::SmartScopedLock<true> L(&*TimerLock);
+  sys::SmartScopedLock<true> L(*TimerLock);
   TimersToPrint.push_back(Timer(true, T));
 }