Avoid forward declaring the entry point without actually defining it

This commit is contained in:
apio 2022-08-26 17:33:03 +02:00
parent 734537a528
commit dc85a8b296
2 changed files with 7 additions and 2 deletions

View File

@ -37,6 +37,11 @@ void IRBuilder::create_program(std::shared_ptr<ProgramNode> program)
{ {
Error::throw_error_without_location(format_string("Missing entry point: %s", Arguments::values["entry"])); Error::throw_error_without_location(format_string("Missing entry point: %s", Arguments::values["entry"]));
} }
if (module->getFunction(Arguments::values["entry"])->empty())
{
Error::throw_error_without_location(
format_string("Entry point %s has no body", Arguments::values["entry"]));
}
} }
} }

View File

@ -2,8 +2,8 @@
"file": "declare-main.sp", "file": "declare-main.sp",
"compile": { "compile": {
"flags": [], "flags": [],
"exit-code": 0, "exit-code": 1,
"stdout": "", "stdout": "",
"stderr": "" "stderr": "\u001b[1;1m\u001b[31;49merror: \u001b[0;0mEntry point main has no body\n"
} }
} }