Add support for 'noreturn' type

It's apparently already in the AST, e.g., for core.internal.abort.
This commit is contained in:
Martin Kinkelin 2021-02-28 17:19:36 +01:00
parent c0630840b7
commit 44daef934a
9 changed files with 23 additions and 9 deletions

View file

@ -665,9 +665,12 @@ void DtoDeclareFunction(FuncDeclaration *fdecl, const bool willDefine) {
// such that they can be overridden by UDAs.
applyTargetMachineAttributes(*func, *gTargetMachine);
if (!fdecl->fbody && opts::noPLT) {
// Add `NonLazyBind` attribute to function declarations,
// the codegen options allow skipping PLT.
func->addFnAttr(LLAttribute::NonLazyBind);
// Add `NonLazyBind` attribute to function declarations,
// the codegen options allow skipping PLT.
func->addFnAttr(LLAttribute::NonLazyBind);
}
if (f->next->toBasetype()->ty == Tnoreturn) {
func->addFnAttr(LLAttribute::NoReturn);
}
applyFuncDeclUDAs(fdecl, irFunc);