Skip to content

Commit fbbb033

Browse files
committed
set does-not-return attribute on julia functions that don't return
1 parent 7983e18 commit fbbb033

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/codegen.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1929,12 +1929,12 @@ static Function *emit_function(jl_lambda_info_t *lam)
19291929
// try to avoid conflicts in the global symbol table
19301930
funcName = "julia_" + funcName;
19311931

1932+
jl_value_t *jlrettype = jl_ast_rettype(lam, (jl_value_t*)ast);
19321933
if (specsig) {
19331934
std::vector<Type*> fsig(0);
19341935
for(size_t i=0; i < jl_tuple_len(lam->specTypes); i++) {
19351936
fsig.push_back(julia_type_to_llvm(jl_tupleref(lam->specTypes,i)));
19361937
}
1937-
jl_value_t *jlrettype = jl_ast_rettype(lam, (jl_value_t*)ast);
19381938
Type *rt = (jlrettype == (jl_value_t*)jl_nothing->type ? T_void : julia_type_to_llvm(jlrettype));
19391939
f = Function::Create(FunctionType::get(rt, fsig, false),
19401940
Function::ExternalLinkage, funcName, jl_Module);
@@ -1950,6 +1950,8 @@ static Function *emit_function(jl_lambda_info_t *lam)
19501950
lam->functionObject = (void*)f;
19511951
}
19521952
}
1953+
if (jlrettype == (jl_value_t*)jl_bottom_type)
1954+
f->setDoesNotReturn();
19531955

19541956
ctx.f = f;
19551957

0 commit comments

Comments
 (0)