Skip to main content

Module drop_names

Module drop_names 

Source
Expand description

Shared drop-glue utilities: reachability checks and synthesized symbol names.

Both the drop-glue synthesizer (gruel-compiler) and the LLVM codegen (gruel-codegen-llvm) need to agree on:

  • whether a type requires a destructor call, and
  • the exact name of the synthesized __gruel_drop_* symbol for that type.

Putting these here avoids duplicating the logic and keeps the two sites in sync automatically — if the names ever need to change, there is one place to edit.

Functions§

drop_fn_name
Return the name of the synthesized __gruel_drop_* function for ty, or None if the type is trivially droppable or is a built-in with a runtime-provided destructor (e.g. String__gruel_drop_String lives in gruel-runtime and is called via a dedicated code path, not through a synthesized wrapper).
type_name_component
A stable, human-readable name component for ty, used inside drop-glue symbol names (e.g. the String_3 in __gruel_drop_array_String_3).
type_needs_drop
Return true if ty requires a drop call when it goes out of scope.