Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot

of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.

Patches for Clang and LLVM-GCC to follow.

llvm-svn: 74614
This commit is contained in:
Owen Anderson
2009-07-01 16:58:40 +00:00
parent 1f50b61329
commit 6773d388aa
60 changed files with 276 additions and 145 deletions

View File

@@ -23,6 +23,7 @@
//
//===----------------------------------------------------------------------===//
#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Constants.h"
@@ -90,8 +91,10 @@ static Function *CreateFibFunction(Module *M) {
int main(int argc, char **argv) {
int n = argc > 1 ? atol(argv[1]) : 24;
LLVMContext Context;
// Create some module to put our function into it.
Module *M = new Module("test");
Module *M = new Module("test", &Context);
// We are about to create the "fib" function:
Function *FibF = CreateFibFunction(M);