diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-07 18:33:04 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-07 18:33:04 +0000 |
commit | a9d1f2c559ef4b2549e29288fe6944e68913ba0f (patch) | |
tree | 79e3d7e0aafc4352dafe175986671f4353c0c5e2 /lib/Support | |
parent | fd15beefeedcb8108913e75e7c736dfcc17b433a (diff) | |
download | external_llvm-a9d1f2c559ef4b2549e29288fe6944e68913ba0f.zip external_llvm-a9d1f2c559ef4b2549e29288fe6944e68913ba0f.tar.gz external_llvm-a9d1f2c559ef4b2549e29288fe6944e68913ba0f.tar.bz2 |
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
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/Annotation.cpp | 8 | ||||
-rw-r--r-- | lib/Support/PluginLoader.cpp | 6 | ||||
-rw-r--r-- | lib/Support/Statistic.cpp | 2 | ||||
-rw-r--r-- | lib/Support/Timer.cpp | 14 |
4 files changed, 15 insertions, 15 deletions
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 FactMapType &getFactMap() { } static void eraseFromFactMap(unsigned ID) { - sys::SmartScopedWriter<true> Writer(&*AnnotationsLock); + sys::SmartScopedWriter<true> Writer(*AnnotationsLock); TheFactMap->erase(ID); } @@ -66,7 +66,7 @@ AnnotationID AnnotationManager::getID(const char *Name) { // Name -> ID 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 @@ AnnotationID AnnotationManager::getID(const char *Name, Factory Fact, // 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 @@ const char *AnnotationManager::getName(AnnotationID ID) { // ID -> Name 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<std::vector<std::string> > Plugins; 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 @@ void PluginLoader::operator=(const std::string &Filename) { } 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 @@ static ManagedStatic<sys::Mutex> StatLock; 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 TimeRecord getTimeRecord(bool Start) { 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::startTimer() { } 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<Name2Timer> NamedTimers; 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) { 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 @@ llvm::GetLibSupportInfoOutputFile() { 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::removeTimer() { } 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)); } |