I'm getting a strange behaviour when I attempt to create my main function:
auto func = static_cast<llvm::Function*>(module->getOrInsertFunction(
types->type_void(), (llvm::Type*)0 ) );
ASSERT( func );
auto block = llvm::BasicBlock::Create( *context, "entry", func );
The "BasicBlock::Create" function is causing a segfault. This only
happens if the function is called "main", any other function and it
works fine. Prior to this call I also do this assert to ensure "main"
doesn't actually exist:
ASSERT( !module->getFunction("main" ) );
I must be missing something trivial, but I'm not sure what.