diff --git a/llvm/include/llvm/System/Mutex.h b/llvm/include/llvm/System/Mutex.h index d2c457dbc91c..9ef5942a702b 100644 --- a/llvm/include/llvm/System/Mutex.h +++ b/llvm/include/llvm/System/Mutex.h @@ -131,15 +131,15 @@ namespace llvm template class SmartScopedLock { - SmartMutex* mtx; + SmartMutex& mtx; public: - SmartScopedLock(SmartMutex* m) : mtx(m) { - mtx->acquire(); + SmartScopedLock(SmartMutex& m) : mtx(m) { + mtx.acquire(); } ~SmartScopedLock() { - mtx->release(); + mtx.release(); } }; diff --git a/llvm/include/llvm/System/RWMutex.h b/llvm/include/llvm/System/RWMutex.h index e577d457afb5..3a288180bf07 100644 --- a/llvm/include/llvm/System/RWMutex.h +++ b/llvm/include/llvm/System/RWMutex.h @@ -141,15 +141,14 @@ namespace llvm /// ScopedReader - RAII acquisition of a reader lock template struct SmartScopedReader { - SmartRWMutex* mutex; + SmartRWMutex& mutex; - explicit SmartScopedReader(SmartRWMutex* m) { - mutex = m; - mutex->reader_acquire(); + explicit SmartScopedReader(SmartRWMutex& m) : mutex(m) { + mutex.reader_acquire(); } ~SmartScopedReader() { - mutex->reader_release(); + mutex.reader_release(); } }; typedef SmartScopedReader ScopedReader; @@ -157,15 +156,14 @@ namespace llvm /// ScopedWriter - RAII acquisition of a writer lock template struct SmartScopedWriter { - SmartRWMutex* mutex; + SmartRWMutex& mutex; - explicit SmartScopedWriter(SmartRWMutex* m) { - mutex = m; - mutex->writer_acquire(); + explicit SmartScopedWriter(SmartRWMutex& m) : mutex(m) { + mutex.writer_acquire(); } ~SmartScopedWriter() { - mutex->writer_release(); + mutex.writer_release(); } }; typedef SmartScopedWriter ScopedWriter; diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index c8f4b520ff18..5f45c980a582 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5010,7 +5010,7 @@ static ManagedStatic > VTMutex; /// getValueTypeList - Return a pointer to the specified value type. /// const MVT *SDNode::getValueTypeList(MVT VT) { - sys::SmartScopedLock Lock(&*VTMutex); + sys::SmartScopedLock Lock(*VTMutex); if (VT.isExtended()) { return &(*EVTs->insert(VT).first); } else { diff --git a/llvm/lib/CompilerDriver/Plugin.cpp b/llvm/lib/CompilerDriver/Plugin.cpp index cb3c7be39dd3..7310d120bff5 100644 --- a/llvm/lib/CompilerDriver/Plugin.cpp +++ b/llvm/lib/CompilerDriver/Plugin.cpp @@ -42,7 +42,7 @@ namespace { namespace llvmc { PluginLoader::PluginLoader() { - llvm::sys::SmartScopedLock Lock(&*PluginMutex); + llvm::sys::SmartScopedLock Lock(*PluginMutex); if (!pluginListInitialized) { for (PluginRegistry::iterator B = PluginRegistry::begin(), E = PluginRegistry::end(); B != E; ++B) @@ -53,7 +53,7 @@ namespace llvmc { } PluginLoader::~PluginLoader() { - llvm::sys::SmartScopedLock Lock(&*PluginMutex); + llvm::sys::SmartScopedLock Lock(*PluginMutex); if (pluginListInitialized) { for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); B != E; ++B) @@ -63,14 +63,14 @@ namespace llvmc { } void PluginLoader::PopulateLanguageMap(LanguageMap& langMap) { - llvm::sys::SmartScopedLock Lock(&*PluginMutex); + llvm::sys::SmartScopedLock Lock(*PluginMutex); for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); B != E; ++B) (*B)->PopulateLanguageMap(langMap); } void PluginLoader::PopulateCompilationGraph(CompilationGraph& graph) { - llvm::sys::SmartScopedLock Lock(&*PluginMutex); + llvm::sys::SmartScopedLock Lock(*PluginMutex); for (PluginList::iterator B = Plugins.begin(), E = Plugins.end(); B != E; ++B) (*B)->PopulateCompilationGraph(graph); diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index b8525a30ecad..21a6f761db53 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -97,7 +97,7 @@ static ExFunc lookupFunction(const Function *F) { ExtName += getTypeID(FT->getContainedType(i)); ExtName += "_" + F->getName(); - sys::ScopedLock Writer(&*FunctionsLock); + sys::ScopedLock Writer(*FunctionsLock); ExFunc FnPtr = FuncNames[ExtName]; if (FnPtr == 0) FnPtr = FuncNames["lle_X_"+F->getName()]; @@ -539,7 +539,7 @@ GenericValue lle_X_fprintf(const FunctionType *FT, void Interpreter::initializeExternalFunctions() { - sys::ScopedLock Writer(&*FunctionsLock); + sys::ScopedLock Writer(*FunctionsLock); FuncNames["lle_X_atexit"] = lle_X_atexit; FuncNames["lle_X_exit"] = lle_X_exit; FuncNames["lle_X_abort"] = lle_X_abort; diff --git a/llvm/lib/Support/Annotation.cpp b/llvm/lib/Support/Annotation.cpp index 4b5b97e41f32..9f76256b295e 100644 --- a/llvm/lib/Support/Annotation.cpp +++ b/llvm/lib/Support/Annotation.cpp @@ -55,7 +55,7 @@ static FactMapType &getFactMap() { } static void eraseFromFactMap(unsigned ID) { - sys::SmartScopedWriter Writer(&*AnnotationsLock); + sys::SmartScopedWriter 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 Writer(&*AnnotationsLock); + sys::SmartScopedWriter 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 Reader(&*AnnotationsLock); + sys::SmartScopedReader 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 Writer(&*AnnotationsLock); + sys::SmartScopedWriter Writer(*AnnotationsLock); getFactMap()[ID.ID] = std::make_pair(F, ExtraData); } else { eraseFromFactMap(ID.ID); diff --git a/llvm/lib/Support/PluginLoader.cpp b/llvm/lib/Support/PluginLoader.cpp index ef32af4b3f38..ea191ad739fe 100644 --- a/llvm/lib/Support/PluginLoader.cpp +++ b/llvm/lib/Support/PluginLoader.cpp @@ -25,7 +25,7 @@ static ManagedStatic > Plugins; static ManagedStatic > PluginsLock; void PluginLoader::operator=(const std::string &Filename) { - sys::SmartScopedLock Lock(&*PluginsLock); + sys::SmartScopedLock 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 Lock(&*PluginsLock); + sys::SmartScopedLock Lock(*PluginsLock); return Plugins.isConstructed() ? Plugins->size() : 0; } std::string &PluginLoader::getPlugin(unsigned num) { - sys::SmartScopedLock Lock(&*PluginsLock); + sys::SmartScopedLock Lock(*PluginsLock); assert(Plugins.isConstructed() && num < Plugins->size() && "Asking for an out of bounds plugin"); return (*Plugins)[num]; diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp index 33570b0ee534..06496fae91d4 100644 --- a/llvm/lib/Support/Statistic.cpp +++ b/llvm/lib/Support/Statistic.cpp @@ -65,7 +65,7 @@ static ManagedStatic 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/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp index ede1dc96e827..8eef2bd48d85 100644 --- a/llvm/lib/Support/Timer.cpp +++ b/llvm/lib/Support/Timer.cpp @@ -145,7 +145,7 @@ static TimeRecord getTimeRecord(bool Start) { static ManagedStatic > ActiveTimers; void Timer::startTimer() { - sys::SmartScopedLock L(&Lock); + sys::SmartScopedLock L(Lock); Started = true; ActiveTimers->push_back(this); TimeRecord TR = getTimeRecord(true); @@ -157,7 +157,7 @@ void Timer::startTimer() { } void Timer::stopTimer() { - sys::SmartScopedLock L(&Lock); + sys::SmartScopedLock L(Lock); TimeRecord TR = getTimeRecord(false); Elapsed += TR.Elapsed; UserTime += TR.UserTime; @@ -229,7 +229,7 @@ static ManagedStatic NamedTimers; static ManagedStatic NamedGroupedTimers; static Timer &getNamedRegionTimer(const std::string &Name) { - sys::SmartScopedLock L(&*TimerLock); + sys::SmartScopedLock 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 L(&*TimerLock); + sys::SmartScopedLock L(*TimerLock); Name2Pair::iterator I = NamedGroupedTimers->find(GroupName); if (I == NamedGroupedTimers->end()) { @@ -365,7 +365,7 @@ llvm::GetLibSupportInfoOutputFile() { void TimerGroup::removeTimer() { - sys::SmartScopedLock L(&*TimerLock); + sys::SmartScopedLock 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 L(&*TimerLock); + sys::SmartScopedLock L(*TimerLock); ++NumTimers; } void TimerGroup::addTimerToPrint(const Timer &T) { - sys::SmartScopedLock L(&*TimerLock); + sys::SmartScopedLock L(*TimerLock); TimersToPrint.push_back(Timer(true, T)); } diff --git a/llvm/lib/Target/TargetData.cpp b/llvm/lib/Target/TargetData.cpp index 7b843df7422d..7dfa05764346 100644 --- a/llvm/lib/Target/TargetData.cpp +++ b/llvm/lib/Target/TargetData.cpp @@ -352,7 +352,7 @@ TargetData::~TargetData() { if (!LayoutInfo.isConstructed()) return; - sys::SmartScopedLock Lock(&*LayoutLock); + sys::SmartScopedLock Lock(*LayoutLock); // Remove any layouts for this TD. LayoutInfoTy &TheMap = *LayoutInfo; for (LayoutInfoTy::iterator I = TheMap.begin(), E = TheMap.end(); I != E; ) { @@ -369,7 +369,7 @@ TargetData::~TargetData() { const StructLayout *TargetData::getStructLayout(const StructType *Ty) const { LayoutInfoTy &TheMap = *LayoutInfo; - sys::SmartScopedLock Lock(&*LayoutLock); + sys::SmartScopedLock Lock(*LayoutLock); StructLayout *&SL = TheMap[LayoutKey(this, Ty)]; if (SL) return SL; @@ -394,7 +394,7 @@ const StructLayout *TargetData::getStructLayout(const StructType *Ty) const { void TargetData::InvalidateStructLayoutInfo(const StructType *Ty) const { if (!LayoutInfo.isConstructed()) return; // No cache. - sys::SmartScopedLock Lock(&*LayoutLock); + sys::SmartScopedLock Lock(*LayoutLock); LayoutInfoTy::iterator I = LayoutInfo->find(LayoutKey(this, Ty)); if (I == LayoutInfo->end()) return; diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index a9e4e78ee1f4..a35003162781 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -307,7 +307,7 @@ ConstantInt *ConstantInt::get(const APInt& V) { ConstantsLock->reader_release(); if (!Slot) { - sys::SmartScopedWriter Writer(&*ConstantsLock); + sys::SmartScopedWriter Writer(*ConstantsLock); ConstantInt *&NewSlot = (*IntConstants)[Key]; if (!Slot) { NewSlot = new ConstantInt(ITy, V); @@ -414,7 +414,7 @@ ConstantFP *ConstantFP::get(const APFloat &V) { ConstantsLock->reader_release(); if (!Slot) { - sys::SmartScopedWriter Writer(&*ConstantsLock); + sys::SmartScopedWriter Writer(*ConstantsLock); ConstantFP *&NewSlot = (*FPConstants)[Key]; if (!NewSlot) { const Type *Ty; @@ -1231,7 +1231,7 @@ public: /// getOrCreate - Return the specified constant from the map, creating it if /// necessary. ConstantClass *getOrCreate(const TypeClass *Ty, const ValType &V) { - sys::SmartScopedLock Lock(&ValueMapLock); + sys::SmartScopedLock Lock(ValueMapLock); MapKey Lookup(Ty, V); ConstantClass* Result = 0; @@ -1249,7 +1249,7 @@ public: } void remove(ConstantClass *CP) { - sys::SmartScopedLock Lock(&ValueMapLock); + sys::SmartScopedLock Lock(ValueMapLock); typename MapTy::iterator I = FindExistingElement(CP); assert(I != Map.end() && "Constant not found in constant table!"); assert(I->second == CP && "Didn't find correct element?"); @@ -1334,7 +1334,7 @@ public: } void refineAbstractType(const DerivedType *OldTy, const Type *NewTy) { - sys::SmartScopedLock Lock(&ValueMapLock); + sys::SmartScopedLock Lock(ValueMapLock); typename AbstractTypeMapTy::iterator I = AbstractTypeMap.find(cast(OldTy)); @@ -1793,7 +1793,7 @@ MDString::MDString(const char *begin, const char *end) static ManagedStatic > MDStringCache; MDString *MDString::get(const char *StrBegin, const char *StrEnd) { - sys::SmartScopedWriter Writer(&*ConstantsLock); + sys::SmartScopedWriter Writer(*ConstantsLock); StringMapEntry &Entry = MDStringCache->GetOrCreateValue( StrBegin, StrEnd); MDString *&S = Entry.getValue(); @@ -1804,7 +1804,7 @@ MDString *MDString::get(const char *StrBegin, const char *StrEnd) { } MDString *MDString::get(const std::string &Str) { - sys::SmartScopedWriter Writer(&*ConstantsLock); + sys::SmartScopedWriter Writer(*ConstantsLock); StringMapEntry &Entry = MDStringCache->GetOrCreateValue( Str.data(), Str.data() + Str.size()); MDString *&S = Entry.getValue(); @@ -1815,7 +1815,7 @@ MDString *MDString::get(const std::string &Str) { } void MDString::destroyConstant() { - sys::SmartScopedWriter Writer(&*ConstantsLock); + sys::SmartScopedWriter Writer(*ConstantsLock); MDStringCache->erase(MDStringCache->find(StrBegin, StrEnd)); destroyConstantImpl(); } @@ -1847,7 +1847,7 @@ MDNode *MDNode::get(Value*const* Vals, unsigned NumVals) { ConstantsLock->reader_release(); if (!N) { - sys::SmartScopedWriter Writer(&*ConstantsLock); + sys::SmartScopedWriter Writer(*ConstantsLock); N = MDNodeSet->FindNodeOrInsertPos(ID, InsertPoint); if (!N) { // InsertPoint will have been set by the FindNodeOrInsertPos call. @@ -1859,7 +1859,7 @@ MDNode *MDNode::get(Value*const* Vals, unsigned NumVals) { } void MDNode::destroyConstant() { - sys::SmartScopedWriter Writer(&*ConstantsLock); + sys::SmartScopedWriter Writer(*ConstantsLock); MDNodeSet->RemoveNode(this); destroyConstantImpl(); @@ -2790,7 +2790,7 @@ void ConstantArray::replaceUsesOfWithOnConstant(Value *From, Value *To, Replacement = ConstantAggregateZero::get(getType()); } else { // Check to see if we have this array type already. - sys::SmartScopedWriter Writer(&*ConstantsLock); + sys::SmartScopedWriter Writer(*ConstantsLock); bool Exists; ArrayConstantsTy::MapTy::iterator I = ArrayConstants->InsertOrGetItem(Lookup, Exists); @@ -2866,7 +2866,7 @@ void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To, Replacement = ConstantAggregateZero::get(getType()); } else { // Check to see if we have this array type already. - sys::SmartScopedWriter Writer(&*ConstantsLock); + sys::SmartScopedWriter Writer(*ConstantsLock); bool Exists; StructConstantsTy::MapTy::iterator I = StructConstants->InsertOrGetItem(Lookup, Exists); diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index a2593350163a..08acc5fec78d 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/lib/VMCore/Function.cpp @@ -242,18 +242,18 @@ static StringPool *GCNamePool; static ManagedStatic > GCLock; bool Function::hasGC() const { - sys::SmartScopedReader Reader(&*GCLock); + sys::SmartScopedReader Reader(*GCLock); return GCNames && GCNames->count(this); } const char *Function::getGC() const { assert(hasGC() && "Function has no collector"); - sys::SmartScopedReader Reader(&*GCLock); + sys::SmartScopedReader Reader(*GCLock); return *(*GCNames)[this]; } void Function::setGC(const char *Str) { - sys::SmartScopedWriter Writer(&*GCLock); + sys::SmartScopedWriter Writer(*GCLock); if (!GCNamePool) GCNamePool = new StringPool(); if (!GCNames) @@ -262,7 +262,7 @@ void Function::setGC(const char *Str) { } void Function::clearGC() { - sys::SmartScopedWriter Writer(&*GCLock); + sys::SmartScopedWriter Writer(*GCLock); if (GCNames) { GCNames->erase(this); if (GCNames->empty()) { diff --git a/llvm/lib/VMCore/LeakDetector.cpp b/llvm/lib/VMCore/LeakDetector.cpp index b5926bcf441a..a6be1afed49b 100644 --- a/llvm/lib/VMCore/LeakDetector.cpp +++ b/llvm/lib/VMCore/LeakDetector.cpp @@ -54,7 +54,7 @@ namespace { // immediately, it is added to the CachedValue Value. If it is // immediately removed, no set search need be performed. void addGarbage(const T* o) { - sys::SmartScopedWriter Writer(&*LeakDetectorLock); + sys::SmartScopedWriter Writer(*LeakDetectorLock); if (Cache) { assert(Ts.count(Cache) == 0 && "Object already in set!"); Ts.insert(Cache); @@ -63,7 +63,7 @@ namespace { } void removeGarbage(const T* o) { - sys::SmartScopedWriter Writer(&*LeakDetectorLock); + sys::SmartScopedWriter Writer(*LeakDetectorLock); if (o == Cache) Cache = 0; // Cache hit else @@ -73,7 +73,7 @@ namespace { bool hasGarbage(const std::string& Message) { addGarbage(0); // Flush the Cache - sys::SmartScopedReader Reader(&*LeakDetectorLock); + sys::SmartScopedReader Reader(*LeakDetectorLock); assert(Cache == 0 && "No value should be cached anymore!"); if (!Ts.empty()) { diff --git a/llvm/lib/VMCore/Pass.cpp b/llvm/lib/VMCore/Pass.cpp index b037994d428b..d82389d99d94 100644 --- a/llvm/lib/VMCore/Pass.cpp +++ b/llvm/lib/VMCore/Pass.cpp @@ -233,7 +233,7 @@ void PassInfo::registerPass() { getPassRegistrar()->RegisterPass(*this); // Notify any listeners. - sys::SmartScopedLock Lock(&ListenersLock); + sys::SmartScopedLock Lock(ListenersLock); if (Listeners) for (std::vector::iterator I = Listeners->begin(), E = Listeners->end(); I != E; ++I) @@ -286,14 +286,14 @@ RegisterAGBase::RegisterAGBase(const char *Name, intptr_t InterfaceID, // PassRegistrationListener ctor - Add the current object to the list of // PassRegistrationListeners... PassRegistrationListener::PassRegistrationListener() { - sys::SmartScopedLock Lock(&ListenersLock); + sys::SmartScopedLock Lock(ListenersLock); if (!Listeners) Listeners = new std::vector(); Listeners->push_back(this); } // dtor - Remove object from list of listeners... PassRegistrationListener::~PassRegistrationListener() { - sys::SmartScopedLock Lock(&ListenersLock); + sys::SmartScopedLock Lock(ListenersLock); std::vector::iterator I = std::find(Listeners->begin(), Listeners->end(), this); assert(Listeners && I != Listeners->end() && diff --git a/llvm/lib/VMCore/PassManager.cpp b/llvm/lib/VMCore/PassManager.cpp index 46f1243e1211..74c09fd865ec 100644 --- a/llvm/lib/VMCore/PassManager.cpp +++ b/llvm/lib/VMCore/PassManager.cpp @@ -392,7 +392,7 @@ public: if (dynamic_cast(P)) return; - sys::SmartScopedLock Lock(&*TimingInfoMutex); + sys::SmartScopedLock Lock(*TimingInfoMutex); std::map::iterator I = TimingData.find(P); if (I == TimingData.end()) I=TimingData.insert(std::make_pair(P, Timer(P->getPassName(), TG))).first; @@ -403,7 +403,7 @@ public: if (dynamic_cast(P)) return; - sys::SmartScopedLock Lock(&*TimingInfoMutex); + sys::SmartScopedLock Lock(*TimingInfoMutex); std::map::iterator I = TimingData.find(P); assert(I != TimingData.end() && "passStarted/passEnded not nested right!"); I->second.stopTimer(); diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp index 40d751704917..b41525149702 100644 --- a/llvm/lib/VMCore/Type.cpp +++ b/llvm/lib/VMCore/Type.cpp @@ -1006,7 +1006,7 @@ const IntegerType *IntegerType::get(unsigned NumBits) { // First, see if the type is already in the table, for which // a reader lock suffices. - sys::SmartScopedLock L(&*TypeMapLock); + sys::SmartScopedLock L(*TypeMapLock); ITy = IntegerTypes->get(IVT); if (!ITy) { @@ -1079,7 +1079,7 @@ FunctionType *FunctionType::get(const Type *ReturnType, FunctionValType VT(ReturnType, Params, isVarArg); FunctionType *FT = 0; - sys::SmartScopedLock L(&*TypeMapLock); + sys::SmartScopedLock L(*TypeMapLock); FT = FunctionTypes->get(VT); if (!FT) { @@ -1129,7 +1129,7 @@ ArrayType *ArrayType::get(const Type *ElementType, uint64_t NumElements) { ArrayValType AVT(ElementType, NumElements); ArrayType *AT = 0; - sys::SmartScopedLock L(&*TypeMapLock); + sys::SmartScopedLock L(*TypeMapLock); AT = ArrayTypes->get(AVT); if (!AT) { @@ -1188,7 +1188,7 @@ VectorType *VectorType::get(const Type *ElementType, unsigned NumElements) { VectorValType PVT(ElementType, NumElements); VectorType *PT = 0; - sys::SmartScopedLock L(&*TypeMapLock); + sys::SmartScopedLock L(*TypeMapLock); PT = VectorTypes->get(PVT); if (!PT) { @@ -1250,7 +1250,7 @@ StructType *StructType::get(const std::vector &ETypes, StructValType STV(ETypes, isPacked); StructType *ST = 0; - sys::SmartScopedLock L(&*TypeMapLock); + sys::SmartScopedLock L(*TypeMapLock); ST = StructTypes->get(STV); if (!ST) { @@ -1329,7 +1329,7 @@ PointerType *PointerType::get(const Type *ValueType, unsigned AddressSpace) { PointerType *PT = 0; - sys::SmartScopedLock L(&*TypeMapLock); + sys::SmartScopedLock L(*TypeMapLock); PT = PointerTypes->get(PVT); if (!PT) { @@ -1488,7 +1488,7 @@ void DerivedType::unlockedRefineAbstractTypeTo(const Type *NewType) { void DerivedType::refineAbstractTypeTo(const Type *NewType) { // All recursive calls will go through unlockedRefineAbstractTypeTo, // to avoid deadlock problems. - sys::SmartScopedLock L(&*TypeMapLock); + sys::SmartScopedLock L(*TypeMapLock); unlockedRefineAbstractTypeTo(NewType); } diff --git a/llvm/lib/VMCore/TypeSymbolTable.cpp b/llvm/lib/VMCore/TypeSymbolTable.cpp index 5ae60e28d7f0..54da8099634a 100644 --- a/llvm/lib/VMCore/TypeSymbolTable.cpp +++ b/llvm/lib/VMCore/TypeSymbolTable.cpp @@ -37,7 +37,7 @@ TypeSymbolTable::~TypeSymbolTable() { std::string TypeSymbolTable::getUniqueName(const std::string &BaseName) const { std::string TryName = BaseName; - sys::SmartScopedReader Reader(&*TypeSymbolTableLock); + sys::SmartScopedReader Reader(*TypeSymbolTableLock); const_iterator End = tmap.end(); @@ -49,7 +49,7 @@ std::string TypeSymbolTable::getUniqueName(const std::string &BaseName) const { // lookup a type by name - returns null on failure Type* TypeSymbolTable::lookup(const std::string& Name) const { - sys::SmartScopedReader Reader(&*TypeSymbolTableLock); + sys::SmartScopedReader Reader(*TypeSymbolTableLock); const_iterator TI = tmap.find(Name); Type* result = 0; @@ -134,7 +134,7 @@ void TypeSymbolTable::insert(const std::string& Name, const Type* T) { // This function is called when one of the types in the type plane are refined void TypeSymbolTable::refineAbstractType(const DerivedType *OldType, const Type *NewType) { - sys::SmartScopedReader Reader(&*TypeSymbolTableLock); + sys::SmartScopedReader Reader(*TypeSymbolTableLock); // Loop over all of the types in the symbol table, replacing any references // to OldType with references to NewType. Note that there may be multiple @@ -165,7 +165,7 @@ void TypeSymbolTable::typeBecameConcrete(const DerivedType *AbsTy) { // Loop over all of the types in the symbol table, dropping any abstract // type user entries for AbsTy which occur because there are names for the // type. - sys::SmartScopedReader Reader(&*TypeSymbolTableLock); + sys::SmartScopedReader Reader(*TypeSymbolTableLock); for (iterator TI = begin(), TE = end(); TI != TE; ++TI) if (TI->second == const_cast(static_cast(AbsTy))) AbsTy->removeAbstractTypeUser(this); @@ -179,7 +179,7 @@ static void DumpTypes(const std::pair& T ) { void TypeSymbolTable::dump() const { cerr << "TypeSymbolPlane: "; - sys::SmartScopedReader Reader(&*TypeSymbolTableLock); + sys::SmartScopedReader Reader(*TypeSymbolTableLock); for_each(tmap.begin(), tmap.end(), DumpTypes); } diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp index c952b7888cdd..e980a5d0ff2e 100644 --- a/llvm/lib/VMCore/Value.cpp +++ b/llvm/lib/VMCore/Value.cpp @@ -430,7 +430,7 @@ void ValueHandleBase::AddToUseList() { if (VP->HasValueHandle) { // If this value already has a ValueHandle, then it must be in the // ValueHandles map already. - sys::SmartScopedReader Reader(&*ValueHandlesLock); + sys::SmartScopedReader Reader(*ValueHandlesLock); ValueHandleBase *&Entry = (*ValueHandles)[VP]; assert(Entry != 0 && "Value doesn't have any handles?"); AddToExistingUseList(&Entry); @@ -442,7 +442,7 @@ void ValueHandleBase::AddToUseList() { // reallocate itself, which would invalidate all of the PrevP pointers that // point into the old table. Handle this by checking for reallocation and // updating the stale pointers only if needed. - sys::SmartScopedWriter Writer(&*ValueHandlesLock); + sys::SmartScopedWriter Writer(*ValueHandlesLock); ValueHandlesTy &Handles = *ValueHandles; const void *OldBucketPtr = Handles.getPointerIntoBucketsArray(); @@ -484,7 +484,7 @@ void ValueHandleBase::RemoveFromUseList() { // If the Next pointer was null, then it is possible that this was the last // ValueHandle watching VP. If so, delete its entry from the ValueHandles // map. - sys::SmartScopedWriter Writer(&*ValueHandlesLock); + sys::SmartScopedWriter Writer(*ValueHandlesLock); ValueHandlesTy &Handles = *ValueHandles; if (Handles.isPointerIntoBucketsArray(PrevPtr)) { Handles.erase(VP);