@@ -303,6 +303,9 @@ class SILFunction
303303 // / empty.
304304 StringRef WasmExportName;
305305
306+ // / Name of a Wasm import module and field if @_extern(wasm) attribute
307+ llvm::Optional<std::pair<StringRef, StringRef>> WasmImportModuleAndField;
308+
306309 // / Has value if there's a profile for this function
307310 // / Contains Function Entry Count
308311 ProfileCounter EntryCount;
@@ -1278,6 +1281,24 @@ class SILFunction
12781281 StringRef wasmExportName () const { return WasmExportName; }
12791282 void setWasmExportName (StringRef value) { WasmExportName = value; }
12801283
1284+ // / Return Wasm import module name if @_extern(wasm) was used otherwise empty
1285+ StringRef wasmImportModuleName () const {
1286+ if (WasmImportModuleAndField)
1287+ return WasmImportModuleAndField->first ;
1288+ return StringRef ();
1289+ }
1290+
1291+ // / Return Wasm import field name if @_extern(wasm) was used otherwise empty
1292+ StringRef wasmImportFieldName () const {
1293+ if (WasmImportModuleAndField)
1294+ return WasmImportModuleAndField->second ;
1295+ return StringRef ();
1296+ }
1297+
1298+ void setWasmImportModuleAndField (StringRef module , StringRef field) {
1299+ WasmImportModuleAndField = std::make_pair (module , field);
1300+ }
1301+
12811302 // / Returns true if this function belongs to a declaration that returns
12821303 // / an opaque result type with one or more availability conditions that are
12831304 // / allowed to produce a different underlying type at runtime.
0 commit comments