llvm.org GIT mirror llvm / 41b016e
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> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266380 91177308-0d34-0410-b5e6-96231b3b80d8 Mehdi Amini 3 years ago
3 changed file(s) with 4 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
234234 friend class Module;
235235 };
236236
237 /// getGlobalContext - Returns a global context. This is for LLVM clients that
238 /// only care about operating on a single thread.
239 extern LLVMContext &getGlobalContext();
240
241237 // Create wrappers for C Binding types (see CBindingWrapping.h).
242238 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLVMContext, LLVMContextRef)
243239
7272
7373 /*===-- Operations on contexts --------------------------------------------===*/
7474
75 static ManagedStatic GlobalContext;
76
7577 LLVMContextRef LLVMContextCreate() {
7678 return wrap(new LLVMContext());
7779 }
7880
79 LLVMContextRef LLVMGetGlobalContext() {
80 return wrap(&getGlobalContext());
81 }
81 LLVMContextRef LLVMGetGlobalContext() { return wrap(&*GlobalContext); }
8282
8383 void LLVMContextSetDiagnosticHandler(LLVMContextRef C,
8484 LLVMDiagnosticHandler Handler,
154154 /*===-- Operations on modules ---------------------------------------------===*/
155155
156156 LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID) {
157 return wrap(new Module(ModuleID, getGlobalContext()));
157 return wrap(new Module(ModuleID, *GlobalContext));
158158 }
159159
160160 LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID,
2323 #include "llvm/Support/SourceMgr.h"
2424 #include
2525 using namespace llvm;
26
27 static ManagedStatic GlobalContext;
28
29 LLVMContext& llvm::getGlobalContext() {
30 return *GlobalContext;
31 }
3226
3327 LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) {
3428 // Create the fixed metadata kinds. This is done in the same order as the