Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
link_dependency.h File Reference

Strict direct-dependency analysis over frozen link indexes. More...

Go to the source code of this file.

Data Structures

 Strict dependency analysis options. More...

Macros

#define LOOMC_ARTIFACT_FORMAT_LINK_DEPENDENCY_REPORT_JSON   "loom-link-dependency-report-json"
 Loom link dependency report JSON artifact format.

Typedefs

typedef uint32_t loomc_link_dependency_artifact_flags_t
 Bitmask of loomc_link_dependency_artifact_flag_bits_t values.

Enumerations

enum  loomc_link_dependency_artifact_flag_bits_t { LOOMC_LINK_DEPENDENCY_ARTIFACT_FLAG_REPORT_JSON = 1u << 0 }
 Dependency-analysis artifact flag bit values. More...

Functions

loomc_status_t loomc_link_analyze_dependencies (const loomc_link_index_t *link_index, loomc_workspace_t *workspace, const loomc_link_dependency_analysis_options_t *options, loomc_result_t **out_result)
 Analyzes strict direct dependencies over a frozen link index.

Detailed Description

Strict direct-dependency analysis over frozen link indexes.

Dependency analysis checks the authored boundary of the INPUT providers in a link index. Exact symbol requirements must be owned by those inputs or exported by a declared direct LIBRARY provider. Other library providers remain visible as the transitive audit universe so diagnostics can distinguish a missing direct dependency from an unsatisfied requirement.

Analysis is metadata-only. It does not materialize function bodies, select roots, specialize templates, alter link resolution, or write files. Open template families remain valid when no provider is available so relocatable modules can be specialized against a target library in a later link.

Example
Analyze a component whose indexed library provider is a declared direct dependency and request a machine-readable report:
const loomc_host_size_t direct_dependencies[] = {
library_provider_ordinal,
};
.structure_size = sizeof(options),
.direct_provider_ordinals = direct_dependencies,
.direct_provider_count = 1,
.component_name = loomc_make_cstring_view("//model:layers"),
.artifact_flags =
};
loomc_result_t* result = NULL;
link_index, workspace, &options, &result);
if (loomc_status_is_ok(status) && !loomc_result_succeeded(result)) {
// Inspect structured diagnostics for missing, inaccessible,
// incompatible, unsatisfied, or ambiguous requirements.
}
size_t loomc_host_size_t
Host allocation and container size type.
Definition base.h:45
@ LOOMC_STRUCTURE_TYPE_LINK_DEPENDENCY_ANALYSIS_OPTIONS
loomc_link_dependency_analysis_options_t.
Definition base.h:285
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
void loomc_result_release(loomc_result_t *result)
Releases result from one owner.
bool loomc_result_succeeded(const loomc_result_t *result)
Returns true when result succeeded.
struct loomc_result_t loomc_result_t
Immutable operation result.
Definition result.h:64

Enumeration Type Documentation

◆ loomc_link_dependency_artifact_flag_bits_t

Dependency-analysis artifact flag bit values.

Enumerator
LOOMC_LINK_DEPENDENCY_ARTIFACT_FLAG_REPORT_JSON 

Emits a schema-versioned JSON dependency report on success or failure.

Function Documentation

◆ loomc_link_analyze_dependencies()

loomc_status_t loomc_link_analyze_dependencies ( const loomc_link_index_t * link_index,
loomc_workspace_t * workspace,
const loomc_link_dependency_analysis_options_t * options,
loomc_result_t ** out_result )

Analyzes strict direct dependencies over a frozen link index.

Parameters
link_indexFrozen index containing INPUT providers being analyzed, declared direct LIBRARY providers, and any transitive library audit universe.
workspaceInvocation-local scratch workspace.
optionsAnalysis options, or NULL for no direct dependencies and no report artifact.
out_resultReceives a retained result for the completed analysis.
Returns
OK when analysis ran to a semantic result. A failed result contains structured dependency diagnostics. Non-OK statuses represent API misuse, malformed indexed metadata, or infrastructure failures.
Ownership
The caller owns out_result on an OK return and releases it with loomc_result_release.
Lifetime
Returned diagnostics and artifacts own their storage and remain valid after the index, workspace, or source handles supplied to the index are released.
Thread safety
The same frozen index may be analyzed concurrently when each call uses a distinct workspace. The same workspace requires external synchronization.