summaryrefslogtreecommitdiffstats
path: root/lib/CompilerDriver/Plugin.cpp
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-06-27 10:44:33 +0000
committered <ed@FreeBSD.org>2009-06-27 10:44:33 +0000
commitcf5cd875b51255602afaed29deb636b66b295671 (patch)
tree9794dc36f22f2a2b3f8063829d8a9b3a7794acc8 /lib/CompilerDriver/Plugin.cpp
parent5c1b5c146f3df07c75174aff06c3bb0968f6857e (diff)
downloadFreeBSD-src-cf5cd875b51255602afaed29deb636b66b295671.zip
FreeBSD-src-cf5cd875b51255602afaed29deb636b66b295671.tar.gz
Import LLVM r74383.
Diffstat (limited to 'lib/CompilerDriver/Plugin.cpp')
-rw-r--r--lib/CompilerDriver/Plugin.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CompilerDriver/Plugin.cpp b/lib/CompilerDriver/Plugin.cpp
index 75abbd0..cb3c7be 100644
--- a/lib/CompilerDriver/Plugin.cpp
+++ b/lib/CompilerDriver/Plugin.cpp
@@ -12,7 +12,8 @@
//===----------------------------------------------------------------------===//
#include "llvm/CompilerDriver/Plugin.h"
-
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/System/Mutex.h"
#include <algorithm>
#include <vector>
@@ -28,6 +29,7 @@ namespace {
static bool pluginListInitialized = false;
typedef std::vector<const llvmc::BasePlugin*> PluginList;
static PluginList Plugins;
+ static llvm::ManagedStatic<llvm::sys::SmartMutex<true> > PluginMutex;
struct ByPriority {
bool operator()(const llvmc::BasePlugin* lhs,
@@ -40,6 +42,7 @@ namespace {
namespace llvmc {
PluginLoader::PluginLoader() {
+ llvm::sys::SmartScopedLock<true> Lock(&*PluginMutex);
if (!pluginListInitialized) {
for (PluginRegistry::iterator B = PluginRegistry::begin(),
E = PluginRegistry::end(); B != E; ++B)
@@ -50,6 +53,7 @@ namespace llvmc {
}
PluginLoader::~PluginLoader() {
+ llvm::sys::SmartScopedLock<true> Lock(&*PluginMutex);
if (pluginListInitialized) {
for (PluginList::iterator B = Plugins.begin(), E = Plugins.end();
B != E; ++B)
@@ -59,12 +63,14 @@ namespace llvmc {
}
void PluginLoader::PopulateLanguageMap(LanguageMap& langMap) {
+ llvm::sys::SmartScopedLock<true> 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<true> Lock(&*PluginMutex);
for (PluginList::iterator B = Plugins.begin(), E = Plugins.end();
B != E; ++B)
(*B)->PopulateCompilationGraph(graph);
OpenPOWER on IntegriCloud