Skip to content

Commit 3c6d6b6

Browse files
committed
feat: provide more information for functions without body
1 parent 76ddc8b commit 3c6d6b6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

kmir/src/kmir/kompile.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,20 @@ def _functions(kmir: KMIR, smir_info: SMIRInfo) -> dict[int, KInner]:
272272
[KApply('symbol(_)_LIB_Symbol_String', [stringToken(sym['IntrinsicSym'])])],
273273
)
274274

275+
# Populate remaining NormalSym entries with `noBody` shims so lookupFunction keeps the real symbol name.
276+
for ty, sym in smir_info.function_symbols.items():
277+
if ty in functions or 'NormalSym' not in sym:
278+
continue
279+
symbol_name = sym['NormalSym']
280+
functions[ty] = KApply(
281+
'MonoItemKind::MonoItemFn',
282+
[
283+
KApply('symbol(_)_LIB_Symbol_String', [stringToken(symbol_name)]),
284+
KApply('defId(_)_BODY_DefId_Int', [intToken(ty)]),
285+
KApply('noBody_BODY_MaybeBody', ()),
286+
],
287+
)
288+
275289
return functions
276290

277291

0 commit comments

Comments
 (0)