[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

@@ -180,6 +180,10 @@ void SILFunctionBuilder::addFunctionAttributes(
}
}
if (auto *EA = Attrs.getAttribute<ExternAttr>()) {
F->setWasmImportModuleAndField(EA->ModuleName, EA->Name);
}
if (Attrs.hasAttribute<UsedAttr>())
F->setMarkedAsUsed(true);