From 36c9fe87bb38d20850ca50d60facd019af54aa30 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 17 Aug 2009 00:54:57 +0000 Subject: Update for LLVM API change. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@79217 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/klee/main.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'tools') 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 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(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(), 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 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 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; } -- cgit 1.4.1