mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -11,6 +11,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Serialization.h"
|
||||
#include "ModuleFormat.h"
|
||||
#include "SILFormat.h"
|
||||
#include "swift/AST/ASTContext.h"
|
||||
#include "swift/AST/ASTMangler.h"
|
||||
@@ -3112,6 +3113,18 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
|
||||
return;
|
||||
}
|
||||
|
||||
case DAK_Extern: {
|
||||
auto *theAttr = cast<ExternAttr>(DA);
|
||||
auto abbrCode = S.DeclTypeAbbrCodes[ExternDeclAttrLayout::Code];
|
||||
llvm::SmallString<32> blob;
|
||||
blob.append(theAttr->ModuleName);
|
||||
blob.append(theAttr->Name);
|
||||
ExternDeclAttrLayout::emitRecord(
|
||||
S.Out, S.ScratchRecord, abbrCode, theAttr->isImplicit(),
|
||||
theAttr->ModuleName.size(), theAttr->Name.size(), blob);
|
||||
return;
|
||||
}
|
||||
|
||||
case DAK_Section: {
|
||||
auto *theAttr = cast<SectionAttr>(DA);
|
||||
auto abbrCode = S.DeclTypeAbbrCodes[SectionDeclAttrLayout::Code];
|
||||
|
||||
Reference in New Issue
Block a user