1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-08-03 01:29:04 +00:00

Fixed problem where functions without body produced an empty block.

This commit is contained in:
jespergravgaard 2020-06-23 00:42:14 +02:00
parent f2314caadb
commit 0f7c6733f7

View File

@ -31,6 +31,9 @@ public class Pass1GenerateControlFlowGraph extends Pass1Base {
for(Procedure procedure : allProcedures) {
final ProcedureCompilation procedureCompilation = getProgram().getProcedureCompilation(procedure.getRef());
final StatementSequence sequence = procedureCompilation.getStatementSequence();
if(sequence.getStatements().size()==0)
// Empry procedures should not produce any blocks
continue;
ControlFlowBlock currentBlock = null;
ControlFlowBlock procBlock = getOrCreateBlock(procedure.getLabel().getRef(), procedure.getRef());
currentBlock = procBlock;