diff options
| author | gingerBill <bill@gingerbill.org> | 2022-05-04 16:40:12 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-05-04 16:40:12 +0100 |
| commit | e4743b15b15ea5f1b2611bbc1718274ebb03bf03 (patch) | |
| tree | d038cfb4a01b8cd910ed153a5a2205412c2ff8f2 /src/checker.cpp | |
| parent | 9f95d6fa6568b83072a8fbe49846390c014a00a1 (diff) | |
Add `@(priority_index=<int>)` for `foreign import`
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 1e33c6e9d..fdd75126f 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -4414,6 +4414,14 @@ DECL_ATTRIBUTE_PROC(foreign_import_decl_attribute) { } ac->require_declaration = true; return true; + } else if (name == "priority_index") { + ExactValue ev = check_decl_attribute_value(c, value); + if (ev.kind != ExactValue_Integer) { + error(elem, "Expected an integer value for '%.*s'", LIT(name)); + } else { + ac->foreign_import_priority_index = exact_value_to_i64(ev); + } + return true; } return false; } @@ -4470,6 +4478,9 @@ void check_add_foreign_import_decl(CheckerContext *ctx, Ast *decl) { mpmc_enqueue(&ctx->info->required_foreign_imports_through_force_queue, e); add_entity_use(ctx, nullptr, e); } + if (ac.foreign_import_priority_index != 0) { + e->LibraryName.priority_index = ac.foreign_import_priority_index; + } if (has_asm_extension(fullpath)) { if (build_context.metrics.arch != TargetArch_amd64 || |