MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / get_names

Function get_names

crates/rustc_codegen_spirv/src/linker/mod.rs:120–143  ·  view source on GitHub ↗
(module: &Module)

Source from the content-addressed store, hash-verified

118}
119
120fn get_names(module: &Module) -> FxHashMap<Word, &str> {
121 let entry_names = module
122 .entry_points
123 .iter()
124 .filter(|i| i.class.opcode == Op::EntryPoint)
125 .map(|i| {
126 (
127 i.operands[1].unwrap_id_ref(),
128 i.operands[2].unwrap_literal_string(),
129 )
130 });
131 let debug_names = module
132 .debug_names
133 .iter()
134 .filter(|i| i.class.opcode == Op::Name)
135 .map(|i| {
136 (
137 i.operands[0].unwrap_id_ref(),
138 i.operands[1].unwrap_literal_string(),
139 )
140 });
141 // items later on take priority
142 entry_names.chain(debug_names).collect()
143}
144
145fn get_name<'a>(names: &FxHashMap<Word, &'a str>, id: Word) -> Cow<'a, str> {
146 names.get(&id).map_or_else(

Callers 5

inlineFunction · 0.85
visitFunction · 0.85
add_use_note_to_errMethod · 0.85
visitFunction · 0.85

Calls 2

iterMethod · 0.80
collectMethod · 0.45

Tested by

no test coverage detected