diff options
| author | Owen Anderson <resistor@mac.com> | 2009-08-19 22:58:34 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2009-08-19 22:58:34 +0000 |
| commit | d6f7af652e6d9c46f23d692176872236b06b9d53 (patch) | |
| tree | ad1c929012261cb33bafe8acf93782f3706d19fc | |
| parent | c59ba42b0f3c187635cd87f41001f0303922cc4c (diff) | |
| download | bcm5719-llvm-d6f7af652e6d9c46f23d692176872236b06b9d53.tar.gz bcm5719-llvm-d6f7af652e6d9c46f23d692176872236b06b9d53.zip | |
AttrListPtr operations need to be atomic.
llvm-svn: 79486
| -rw-r--r-- | llvm/lib/VMCore/Attributes.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Attributes.cpp b/llvm/lib/VMCore/Attributes.cpp index 91c7320a708..73c92ec6c09 100644 --- a/llvm/lib/VMCore/Attributes.cpp +++ b/llvm/lib/VMCore/Attributes.cpp @@ -175,14 +175,17 @@ AttrListPtr AttrListPtr::get(const AttributeWithIndex *Attrs, unsigned NumAttrs) //===----------------------------------------------------------------------===// AttrListPtr::AttrListPtr(AttributeListImpl *LI) : AttrList(LI) { + sys::SmartScopedLock<true> Lock(*ALMutex); if (LI) LI->AddRef(); } AttrListPtr::AttrListPtr(const AttrListPtr &P) : AttrList(P.AttrList) { + sys::SmartScopedLock<true> Lock(*ALMutex); if (AttrList) AttrList->AddRef(); } const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) { + sys::SmartScopedLock<true> Lock(*ALMutex); if (AttrList == RHS.AttrList) return *this; if (AttrList) AttrList->DropRef(); AttrList = RHS.AttrList; @@ -191,6 +194,7 @@ const AttrListPtr &AttrListPtr::operator=(const AttrListPtr &RHS) { } AttrListPtr::~AttrListPtr() { + sys::SmartScopedLock<true> Lock(*ALMutex); if (AttrList) AttrList->DropRef(); } |

