Struct rustc_codegen_llvm::debuginfo::metadata::TypeMap [−][src]
pub struct TypeMap<'ll, 'tcx> {
unique_id_interner: TypeIdInterner,
unique_id_to_metadata: FxHashMap<UniqueTypeId, &'ll DIType>,
type_to_metadata: FxHashMap<Ty<'tcx>, &'ll DIType>,
type_to_unique_id: FxHashMap<Ty<'tcx>, UniqueTypeId>,
}
Expand description
The TypeMap
is where the CrateDebugContext
holds the type metadata nodes
created so far. The metadata nodes are indexed by UniqueTypeId
, and, for
faster lookup, also by Ty
. The TypeMap
is responsible for creating
UniqueTypeId
s.
Fields
unique_id_interner: TypeIdInterner
The UniqueTypeId
s created so far.
unique_id_to_metadata: FxHashMap<UniqueTypeId, &'ll DIType>
A map from UniqueTypeId
to debuginfo metadata for that type. This is a 1:1 mapping.
type_to_metadata: FxHashMap<Ty<'tcx>, &'ll DIType>
A map from types to debuginfo metadata. This is an N:1 mapping.
type_to_unique_id: FxHashMap<Ty<'tcx>, UniqueTypeId>
A map from types to UniqueTypeId
. This is an N:1 mapping.
Implementations
Adds a Ty to metadata mapping to the TypeMap. The method will fail if the mapping already exists.
Removes a Ty
-to-metadata mapping.
This is useful when computing the metadata for a potentially
recursive type (e.g., a function pointer of the form:
fn foo() -> impl Copy { foo }
This kind of type cannot be properly represented via LLVM debuginfo. As a workaround, we register a temporary Ty to metadata mapping for the function before we compute its actual metadata. If the metadata computation ends up recursing back to the original function, it will use the temporary mapping for the inner self-reference, preventing us from recursing forever.
This function is used to remove the temporary metadata mapping after we’ve computed the actual metadata.
fn register_unique_id_with_metadata(
&mut self,
unique_type_id: UniqueTypeId,
metadata: &'ll DIType
)
fn register_unique_id_with_metadata(
&mut self,
unique_type_id: UniqueTypeId,
metadata: &'ll DIType
)
Adds a UniqueTypeId
to metadata mapping to the TypeMap
. The method will
fail if the mapping already exists.
Gets the string representation of a UniqueTypeId
. This method will fail if
the ID is unknown.
fn get_unique_type_id_of_type<'a>(
&mut self,
cx: &CodegenCx<'a, 'tcx>,
type_: Ty<'tcx>
) -> UniqueTypeId
fn get_unique_type_id_of_type<'a>(
&mut self,
cx: &CodegenCx<'a, 'tcx>,
type_: Ty<'tcx>
) -> UniqueTypeId
Gets the UniqueTypeId
for the given type. If the UniqueTypeId
for the given
type has been requested before, this is just a table lookup. Otherwise, an
ID will be generated and stored for later lookup.
fn get_unique_type_id_of_enum_variant<'a>(
&mut self,
cx: &CodegenCx<'a, 'tcx>,
enum_type: Ty<'tcx>,
variant_name: &str
) -> UniqueTypeId
fn get_unique_type_id_of_enum_variant<'a>(
&mut self,
cx: &CodegenCx<'a, 'tcx>,
enum_type: Ty<'tcx>,
variant_name: &str
) -> UniqueTypeId
Gets the UniqueTypeId
for an enum variant. Enum variants are not really
types of their own, so they need special handling. We still need a
UniqueTypeId
for them, since to debuginfo they are real types.
fn get_unique_type_id_str_of_enum_variant_part(
&mut self,
enum_type_id: UniqueTypeId
) -> String
fn get_unique_type_id_str_of_enum_variant_part(
&mut self,
enum_type_id: UniqueTypeId
) -> String
Gets the unique type ID string for an enum variant part.
Variant parts are not types and shouldn’t really have their own ID,
but it makes set_members_of_composite_type()
simpler.
Trait Implementations
Auto Trait Implementations
impl<'ll, 'tcx> !RefUnwindSafe for TypeMap<'ll, 'tcx>
impl<'ll, 'tcx> !UnwindSafe for TypeMap<'ll, 'tcx>
Blanket Implementations
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 200 bytes