From 4be7463cb3b34c8cb7c07f432f747b540aac74e0 Mon Sep 17 00:00:00 2001 From: Stefano Sanfilippo Date: Mon, 9 Dec 2019 18:02:54 +0100 Subject: [PATCH] Replace deprecated TypeBuilder with FunctionType::get. The TypeBuilder API has been removed in https://reviews.llvm.org/D56573, and breaks compilation in LLVM 9+. --- src/codegen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/codegen.cpp b/src/codegen.cpp index 9809bea..dad75e6 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -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::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);