Since PassRegistry is currently a shared global object, it needs locking. While it might intuitively seem

that all the setup of this class currently happens at static initialization time, this misses the fact
that some later events can cause mutation of the PassRegistrationListeners list, and thus cause race issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114036 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson
2010-09-15 23:03:33 +00:00
parent 8a26f81889
commit b6d760c7d5
2 changed files with 9 additions and 0 deletions

View File

@@ -18,6 +18,7 @@
#define LLVM_PASSREGISTRY_H
#include "llvm/ADT/StringRef.h"
#include "llvm/System/Mutex.h"
namespace llvm {
@@ -32,6 +33,7 @@ struct PassRegistrationListener;
/// each thread.
class PassRegistry {
mutable void *pImpl;
mutable sys::SmartMutex<true> Lock;
void *getImpl() const;
public: