[−][src]Struct rustc_codegen_llvm::debuginfo::metadata::TypeMap

pub struct TypeMap<'ll, 'tcx> {
    unique_id_interner: Interner,
    unique_id_to_metadata: FxHashMap<UniqueTypeId, &'ll DIType>,
    type_to_metadata: FxHashMap<Ty<'tcx>, &'ll DIType>,
    type_to_unique_id: FxHashMap<Ty<'tcx>, UniqueTypeId>,
}

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 UniqueTypeIds.

Fields

unique_id_interner: Interner

The UniqueTypeIds 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

impl<'ll, 'tcx> TypeMap<'ll, 'tcx>[src]

pub(in debuginfo::metadata) fn register_type_with_metadata(
    &mut self,
    type_: Ty<'tcx>,
    metadata: &'ll DIType
)
[src]

Adds a Ty to metadata mapping to the TypeMap. The method will fail if the mapping already exists.

pub(in debuginfo::metadata) fn remove_type(
    &mut self,
    type_: Ty<'tcx>
)
[src]

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.

pub(in debuginfo::metadata) fn register_unique_id_with_metadata(
    &mut self,
    unique_type_id: UniqueTypeId,
    metadata: &'ll DIType
)
[src]

Adds a UniqueTypeId to metadata mapping to the TypeMap. The method will fail if the mapping already exists.

pub(in debuginfo::metadata) fn find_metadata_for_type(
    &self,
    type_: Ty<'tcx>
) -> Option<&'ll DIType>
[src]

pub(in debuginfo::metadata) fn find_metadata_for_unique_id(
    &self,
    unique_type_id: UniqueTypeId
) -> Option<&'ll DIType>
[src]

pub(in debuginfo::metadata) fn get_unique_type_id_as_string(
    &self,
    unique_type_id: UniqueTypeId
) -> &str
[src]

Gets the string representation of a UniqueTypeId. This method will fail if the ID is unknown.

pub(in debuginfo::metadata) fn get_unique_type_id_of_type<'a>(
    &mut self,
    cx: &CodegenCx<'a, 'tcx>,
    type_: Ty<'tcx>
) -> UniqueTypeId
[src]

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.

pub(in debuginfo::metadata) fn get_unique_type_id_of_enum_variant<'a>(
    &mut self,
    cx: &CodegenCx<'a, 'tcx>,
    enum_type: Ty<'tcx>,
    variant_name: &str
) -> UniqueTypeId
[src]

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.

pub(in debuginfo::metadata) fn get_unique_type_id_str_of_enum_variant_part(
    &mut self,
    enum_type_id: UniqueTypeId
) -> String
[src]

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

impl<'ll, 'tcx> Default for TypeMap<'ll, 'tcx>[src]

Auto Trait Implementations

impl<'ll, 'tcx> !RefUnwindSafe for TypeMap<'ll, 'tcx>

impl<'ll, 'tcx> !Send for TypeMap<'ll, 'tcx>

impl<'ll, 'tcx> !Sync for TypeMap<'ll, 'tcx>

impl<'ll, 'tcx> Unpin for TypeMap<'ll, 'tcx>

impl<'ll, 'tcx> !UnwindSafe for TypeMap<'ll, 'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.