kaleidoscope: add missing check in the FunctionAST::codegen (#76322)
kaleidoscope chapter 03 explanation has this function redefine check, but it was missing in the code sample. Signed-off-by: amila <amila.15@cse.mrt.ac.lk>
This commit is contained in:
parent
4994bcef13
commit
56fe9097fc
@ -490,6 +490,9 @@ Function *FunctionAST::codegen() {
|
||||
if (!TheFunction)
|
||||
return nullptr;
|
||||
|
||||
if (!TheFunction->empty())
|
||||
return (Function *)LogErrorV("Function cannot be redefined.");
|
||||
|
||||
// Create a new basic block to start insertion into.
|
||||
BasicBlock *BB = BasicBlock::Create(*TheContext, "entry", TheFunction);
|
||||
Builder->SetInsertPoint(BB);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user