Migration from 3.8 to 6.0 questions (segfault most concerning)

I’m encountering a few problems in my migration that I haven’t yet figured out.

getOrInsertFunction is generating a SEGFAULT at FunctionType::isValidArgumentType(llvm::Type*). I’m calling it as:

generic_ptr_ = llvm::PointerType::get( llvm::Type::getInt8Ty(context), 0 );
f_natural_int = llvm::IntegerType::get(context, 64);
module->getOrInsertFunction(
"count_malloc", generic_ptr, f_natural_int, (llvm::Type*)0 );

It appears there is no more Reloc::Default or CodeModel::Default, but the docs on those fields indicate there is still a target default. How do I get the default relocation and codeModel?

I’m still using the legacy::PassManager. Is there a new way to do the passes now?

There docs still reference tool_output_file****, but it appears the new name, in the header, is ToolOutputFile.

I found the problem with `getOrInsertFunction`. It's now using a C++
variadic template, thus I shouldn't provide the trailing null sentry.
Changing to this works:

module\->getOrInsertFunction\("count\_malloc", generic\_ptr,

f_natural_int );

It looks like LLVM is being slowly C++ modernized, I do the same in my
code over time. :slight_smile: