about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-17 00:54:57 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-17 00:54:57 +0000
commit36c9fe87bb38d20850ca50d60facd019af54aa30 (patch)
tree6c26f044da7a248b497fd9e362f1344b87189844 /tools
parent1d539296be5701036e8c48dac75add46eaf03a3f (diff)
downloadklee-36c9fe87bb38d20850ca50d60facd019af54aa30.tar.gz
Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@79217 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/klee/main.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index f3222336..f7a8f0bf 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -618,11 +618,11 @@ static int initEnv(Module *mainModule) {
 
   /* Insert void klee_init_env(int* argc, char*** argv) */
   std::vector<const Type*> params;
-  params.push_back(Type::Int32Ty);
-  params.push_back(Type::Int32Ty);
+  params.push_back(Type::getInt32Ty(getGlobalContext()));
+  params.push_back(Type::getInt32Ty(getGlobalContext()));
   Function* initEnvFn = 
     cast<Function>(mainModule->getOrInsertFunction("klee_init_env",
-                                                   Type::VoidTy,
+                                                   Type::getVoidTy(getGlobalContext()),
                                                    argcPtr->getType(),
                                                    argvPtr->getType(),
                                                    NULL));
@@ -928,28 +928,29 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule) {
   Function *f;
   // force import of __uClibc_main
   mainModule->getOrInsertFunction("__uClibc_main",
-                                  FunctionType::get(Type::VoidTy,
+                                  FunctionType::get(Type::getVoidTy(getGlobalContext()),
                                                     std::vector<const Type*>(),
                                                     true));
   
   // force various imports
   if (WithPOSIXRuntime) {
+    const llvm::Type *i8Ty = Type::getInt8Ty(getGlobalContext());
     mainModule->getOrInsertFunction("realpath",
-                                    PointerType::getUnqual(Type::Int8Ty),
-                                    PointerType::getUnqual(Type::Int8Ty),
-                                    PointerType::getUnqual(Type::Int8Ty),
+                                    PointerType::getUnqual(i8Ty),
+                                    PointerType::getUnqual(i8Ty),
+                                    PointerType::getUnqual(i8Ty),
                                     NULL);
     mainModule->getOrInsertFunction("getutent",
-                                    PointerType::getUnqual(Type::Int8Ty),
+                                    PointerType::getUnqual(i8Ty),
                                     NULL);
     mainModule->getOrInsertFunction("__fgetc_unlocked",
-                                    Type::Int32Ty,
-                                    PointerType::getUnqual(Type::Int8Ty),
+                                    Type::getInt32Ty(getGlobalContext()),
+                                    PointerType::getUnqual(i8Ty),
                                     NULL);
     mainModule->getOrInsertFunction("__fputc_unlocked",
-                                    Type::Int32Ty,
-                                    Type::Int32Ty,
-                                    PointerType::getUnqual(Type::Int8Ty),
+                                    Type::getInt32Ty(getGlobalContext()),
+                                    Type::getInt32Ty(getGlobalContext()),
+                                    PointerType::getUnqual(i8Ty),
                                     NULL);
   }
 
@@ -1039,11 +1040,11 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule) {
   std::vector<const Type*> fArgs;
   fArgs.push_back(ft->getParamType(1)); // argc
   fArgs.push_back(ft->getParamType(2)); // argv
-  Function *stub = Function::Create(FunctionType::get(Type::Int32Ty, fArgs, false),
+  Function *stub = Function::Create(FunctionType::get(Type::getInt32Ty(getGlobalContext()), fArgs, false),
       			      GlobalVariable::ExternalLinkage,
       			      "main",
       			      mainModule);
-  BasicBlock *bb = BasicBlock::Create("entry", stub);
+  BasicBlock *bb = BasicBlock::Create(getGlobalContext(), "entry", stub);
 
   std::vector<llvm::Value*> args;
   args.push_back(llvm::ConstantExpr::getBitCast(userMainFn, 
@@ -1056,7 +1057,7 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule) {
   args.push_back(Constant::getNullValue(ft->getParamType(6))); // stack_end
   CallInst::Create(uclibcMainFn, args.begin(), args.end(), "", bb);
   
-  new UnreachableInst(bb);
+  new UnreachableInst(getGlobalContext(), bb);
 
   return mainModule;
 }