Replace deprecated TypeBuilder with FunctionType::get.

The TypeBuilder API has been removed in https://reviews.llvm.org/D56573, and breaks compilation in LLVM 9+.
This commit is contained in:
Stefano Sanfilippo 2019-12-09 18:02:54 +01:00
parent 21f27ec261
commit 4be7463cb3

View File

@ -15,7 +15,6 @@
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/TypeBuilder.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Support/raw_os_ostream.h"
#include "llvm/Transforms/Scalar.h"
@ -165,7 +164,8 @@ llvm::Value* NestedScopes::lookup(const std::string& name) {
}
void IRGenerator::declareBuiltins() {
llvm::FunctionType* printf_type = llvm::TypeBuilder<int(char*, ...), false>::get(context_);
llvm::FunctionType* printf_type =
llvm::FunctionType::get(builder_.getInt32Ty(), {builder_.getInt8PtrTy()}, true);
auto no_alias = llvm::AttributeList().addAttribute(context_, 1, llvm::Attribute::NoAlias);
module_->getOrInsertFunction("printf", printf_type, no_alias);