diff options
-rw-r--r-- | llvm/include/llvm/IR/LLVMContext.h | 4 | ||||
-rw-r--r-- | llvm/lib/IR/Core.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/IR/LLVMContext.cpp | 6 |
3 files changed, 4 insertions, 14 deletions
diff --git a/llvm/include/llvm/IR/LLVMContext.h b/llvm/include/llvm/IR/LLVMContext.h index 415c1fea915..e4533446399 100644 --- a/llvm/include/llvm/IR/LLVMContext.h +++ b/llvm/include/llvm/IR/LLVMContext.h @@ -235,10 +235,6 @@ private: friend class Module; }; -/// getGlobalContext - Returns a global context. This is for LLVM clients that -/// only care about operating on a single thread. -extern LLVMContext &getGlobalContext(); - // Create wrappers for C Binding types (see CBindingWrapping.h). DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLVMContext, LLVMContextRef) diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index 1b4ad203969..43a25838369 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -73,13 +73,13 @@ void LLVMDisposeMessage(char *Message) { /*===-- Operations on contexts --------------------------------------------===*/ +static ManagedStatic<LLVMContext> GlobalContext; + LLVMContextRef LLVMContextCreate() { return wrap(new LLVMContext()); } -LLVMContextRef LLVMGetGlobalContext() { - return wrap(&getGlobalContext()); -} +LLVMContextRef LLVMGetGlobalContext() { return wrap(&*GlobalContext); } void LLVMContextSetDiagnosticHandler(LLVMContextRef C, LLVMDiagnosticHandler Handler, @@ -155,7 +155,7 @@ LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI) { /*===-- Operations on modules ---------------------------------------------===*/ LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID) { - return wrap(new Module(ModuleID, getGlobalContext())); + return wrap(new Module(ModuleID, *GlobalContext)); } LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID, diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index 673a8c19074..0e8d3e826aa 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -25,12 +25,6 @@ #include <cctype> using namespace llvm; -static ManagedStatic<LLVMContext> GlobalContext; - -LLVMContext& llvm::getGlobalContext() { - return *GlobalContext; -} - LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) { // Create the fixed metadata kinds. This is done in the same order as the // MD_* enum values so that they correspond. |