[wasm] add @_extern(wasm) attribute support

This attribute instructs the compiler that this function declaration
should be "import"ed from host environment. It's equivalent of Clang's
`__attribute__((import_module("module"), import_name("field")))`
This commit is contained in:
Yuta Saito
2023-08-31 20:29:16 +00:00
parent 356bfd56db
commit bd898b0e7e
21 changed files with 311 additions and 3 deletions

View File

@@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTMODULE_VERSION_MINOR = 811; // default argument isolation
const uint16_t SWIFTMODULE_VERSION_MINOR = 812; // @_extern(wasm)
/// A standard hash seed used for all string hashes in a serialized module.
///
@@ -2340,6 +2340,13 @@ namespace decls_block {
BCBlob // declaration name
>;
using ExternDeclAttrLayout = BCRecordLayout<Extern_DECL_ATTR,
BCFixed<1>, // implicit flag
BCVBR<4>, // number of bytes in module name
BCVBR<4>, // number of bytes in name
BCBlob // module name and declaration name
>;
using DocumentationDeclAttrLayout = BCRecordLayout<
Documentation_DECL_ATTR,
BCFixed<1>, // implicit flag