Add a global context, for easing backwards compatibility.

llvm-svn: 74574
This commit is contained in:
Owen Anderson 2009-06-30 23:39:59 +00:00
parent d0a08e0430
commit 1938fb1954
2 changed files with 10 additions and 0 deletions

View File

@ -197,6 +197,9 @@ public:
VectorType* getVectorTypeTruncatedElement(const VectorType* VTy);
};
/// FOR BACKWARDS COMPATIBILITY - Returns a global context.
LLVMContext* getGlobalContext();
}
#endif

View File

@ -15,10 +15,17 @@
#include "llvm/LLVMContext.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Support/ManagedStatic.h"
#include "LLVMContextImpl.h"
using namespace llvm;
static ManagedStatic<LLVMContext> GlobalContext;
LLVMContext* getGlobalContext() {
return &*GlobalContext;
}
LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl()) { }
LLVMContext::~LLVMContext() { delete pImpl; }