Skip the escape analysis for an executable's entry point and suggest clearing stores

This commit is contained in:
gingerBill committed 2026-10-07 13:38:22 +01:00
1 parent 238699e793
commit 5522d18745
2 files changed
+24 -2

No files matched your search

+11 -1
View File
@@ -2531,7 +2531,17 @@ gb_internal bool check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *de
}
check_close_scope(ctx);
check_proc_escapes(type, body);
// the entry point of an executable only returns as the program ends
bool is_entry_point = false;
if (build_context.build_mode == BuildMode_Executable &&
!build_context.no_entry_point &&
build_context.command_kind != Command_test) {
Entity *proc_entity = decl->entity.load();
is_entry_point = proc_entity != nullptr && proc_entity == ctx->info->entry_point;
}
if (!is_entry_point) {
check_proc_escapes(type, body);
}
check_scope_usage(ctx->checker, ctx->scope, check_vet_flags(body));