Nuke getGlobalContext() from LLVM (but the C API)

The only use for getGlobalContext() is in the C API.
Let's just move the static global here and nuke the C++ API.

Differential Revision: http://reviews.llvm.org/D19094

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266380
This commit is contained in:
Mehdi Amini 2016-04-14 21:59:18 +00:00
parent 03b42e41bf
commit dc4c095d51
3 changed files with 4 additions and 14 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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.