mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-03 19:13:15 +01:00
[svn r241] Fixed missing terminator for void main() with inline asm block.
This commit is contained in:
@@ -694,6 +694,19 @@ void DtoDefineFunc(FuncDeclaration* fd)
|
||||
}
|
||||
}
|
||||
|
||||
// if the last block is not terminated we return a null value or void
|
||||
// for some unknown reason this is needed when a void main() has a inline asm block ...
|
||||
// this should be harmless for well formed code!
|
||||
lastbb = &func->getBasicBlockList().back();
|
||||
if (!lastbb->getTerminator())
|
||||
{
|
||||
Logger::println("adding missing return statement");
|
||||
if (func->getReturnType() == llvm::Type::VoidTy)
|
||||
llvm::ReturnInst::Create(lastbb);
|
||||
else
|
||||
llvm::ReturnInst::Create(llvm::Constant::getNullValue(func->getReturnType()), lastbb);
|
||||
}
|
||||
|
||||
gIR->functions.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user