diff options
author | ed <ed@FreeBSD.org> | 2009-06-27 10:44:33 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-27 10:44:33 +0000 |
commit | cf5cd875b51255602afaed29deb636b66b295671 (patch) | |
tree | 9794dc36f22f2a2b3f8063829d8a9b3a7794acc8 /lib/Support/Annotation.cpp | |
parent | 5c1b5c146f3df07c75174aff06c3bb0968f6857e (diff) | |
download | FreeBSD-src-cf5cd875b51255602afaed29deb636b66b295671.zip FreeBSD-src-cf5cd875b51255602afaed29deb636b66b295671.tar.gz |
Import LLVM r74383.
Diffstat (limited to 'lib/Support/Annotation.cpp')
-rw-r--r-- | lib/Support/Annotation.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Support/Annotation.cpp b/lib/Support/Annotation.cpp index 9c3efa3..b778043 100644 --- a/lib/Support/Annotation.cpp +++ b/lib/Support/Annotation.cpp @@ -68,9 +68,12 @@ AnnotationID AnnotationManager::getID(const char *Name) { // Name -> ID if (I == E) { sys::SmartScopedWriter<true> Writer(&*AnnotationsLock); I = IDMap->find(Name); - if (I == IDMap->end()) - (*IDMap)[Name] = IDCounter++; // Add a new element - return AnnotationID(IDCounter-1); + if (I == IDMap->end()) { + unsigned newCount = sys::AtomicIncrement(&IDCounter); + (*IDMap)[Name] = newCount-1; // Add a new element + return AnnotationID(newCount-1); + } else + return AnnotationID(I->second); } return AnnotationID(I->second); } |