Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
cxx.h
Go to the documentation of this file.
1// Copyright 2026 The IREE Authors
2//
3// Licensed under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
7#ifndef LOOMC_IMPORT_CXX_H_
8#define LOOMC_IMPORT_CXX_H_
9
10#include "loomc/module.h"
11
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
36
44
45typedef uint32_t loomc_cxx_import_flags_t;
46
69 void* user_data, loomc_string_view_t path, loomc_source_t** out_source);
70
78
86
127
154 loomc_context_t* context, loomc_workspace_t* workspace,
155 const loomc_source_t* source, const loomc_cxx_import_options_t* options,
156 loomc_allocator_t allocator, loomc_module_t** out_module,
157 loomc_result_t** out_result);
158
159#ifdef __cplusplus
160} // extern "C"
161#endif
162
163#endif // LOOMC_IMPORT_CXX_H_
#define LOOMC_API_EXPORT
Exports a public Loom C API symbol from a shared library build.
Definition base.h:34
size_t loomc_host_size_t
Host allocation and container size type.
Definition base.h:45
loomc_structure_type_t
Structure type values used by extensible public descriptors.
Definition base.h:181
#define LOOMC_API_PTR
Marks a public callback function pointer type.
Definition base.h:38
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
struct loomc_context_t loomc_context_t
Immutable Loom API context.
Definition context.h:47
loomc_status_t(* loomc_cxx_source_provider_fn_t)(void *user_data, loomc_string_view_t path, loomc_source_t **out_source)
Resolves a candidate include path to immutable source bytes.
Definition cxx.h:68
loomc_status_t loomc_module_import_cxx(loomc_context_t *context, loomc_workspace_t *workspace, const loomc_source_t *source, const loomc_cxx_import_options_t *options, loomc_allocator_t allocator, loomc_module_t **out_module, loomc_result_t **out_result)
Imports C/C++ source into a verified High IR module, without cleanup passes.
loomc_cxx_import_flag_bits_t
Explicit source permissions and include delivery policy.
Definition cxx.h:38
@ LOOMC_CXX_IMPORT_FLAG_APPROXIMATE_FUNCTIONS
Permit approximate mathematical functions (Loom's AFN contract).
Definition cxx.h:40
@ LOOMC_CXX_IMPORT_FLAG_NO_BUILTIN_INCLUDES
Omit the embedded system include root; use caller paths/providers only.
Definition cxx.h:42
uint32_t loomc_cxx_import_flags_t
Bitmask of loomc_cxx_import_flag_bits_t values.
Definition cxx.h:45
loomc_cxx_data_model_t
Source integer and pointer layout, independent of the importing process.
Definition cxx.h:28
@ LOOMC_CXX_DATA_MODEL_LP64
32-bit int; 64-bit long and pointers.
Definition cxx.h:30
@ LOOMC_CXX_DATA_MODEL_ILP32
32-bit int, long, and pointers.
Definition cxx.h:34
@ LOOMC_CXX_DATA_MODEL_LLP64
32-bit int and long; 64-bit pointers.
Definition cxx.h:32
Opaque in-memory Loom modules.
struct loomc_module_t loomc_module_t
Opaque parsed, linked, optimized, or lowered module.
Definition module.h:89
struct loomc_result_t loomc_result_t
Immutable operation result.
Definition result.h:71
struct loomc_source_t loomc_source_t
Immutable source handle.
Definition source.h:81
Host allocator used for persistent Loom object storage.
Definition base.h:390
Preprocessor definition applied after the frontend's predefined macros.
Definition cxx.h:80
loomc_string_view_t value
Replacement token text; empty defines an empty macro.
Definition cxx.h:84
loomc_string_view_t name
Macro name, including parameters for a function-like macro.
Definition cxx.h:82
Configuration for one source translation unit.
Definition cxx.h:92
loomc_cxx_import_flags_t flags
Source permissions and include delivery flags.
Definition cxx.h:106
loomc_host_size_t structure_size
Size of this structure in bytes, or zero.
Definition cxx.h:96
loomc_host_size_t include_path_count
Number of user include directories.
Definition cxx.h:112
loomc_cxx_source_provider_t source_provider
Optional include provider; embedded headers are resolved separately.
Definition cxx.h:108
loomc_host_size_t root_count
Number of explicitly selected roots.
Definition cxx.h:125
const loomc_string_view_t * include_paths
User include directories, searched after quoted local includes.
Definition cxx.h:110
const loomc_cxx_define_t * defines
Ordered macro definitions.
Definition cxx.h:118
const loomc_string_view_t * system_include_paths
System include directories, searched before the embedded system root.
Definition cxx.h:114
loomc_string_view_t triple
Source ABI triple, independent of output target selection.
Definition cxx.h:102
loomc_host_size_t define_count
Number of macro definitions.
Definition cxx.h:120
loomc_string_view_t standard
Frontend standard spelling, such as c23 or c++26. Empty selects c++26.
Definition cxx.h:100
loomc_host_size_t system_include_path_count
Number of system include directories.
Definition cxx.h:116
const loomc_string_view_t * roots
Qualified source function names to export.
Definition cxx.h:123
const void * next
Reserved extension chain. Must be NULL.
Definition cxx.h:98
loomc_structure_type_t type
Structure type; LOOMC_STRUCTURE_TYPE_CXX_IMPORT_OPTIONS when nonzero.
Definition cxx.h:94
loomc_cxx_data_model_t data_model
Source integer and pointer layout.
Definition cxx.h:104
Optional source provider replacing filesystem include reads.
Definition cxx.h:72
void * user_data
Caller-owned state borrowed until import returns.
Definition cxx.h:76
loomc_cxx_source_provider_fn_t fn
Callback, or NULL to read ordinary filesystem paths.
Definition cxx.h:74
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63
struct loomc_workspace_t loomc_workspace_t
Mutable per-worker scratch workspace.
Definition workspace.h:54