in src/reader.rs [584:664]
fn read_functions<E: Endian, T: GcovReader<E> + Sized>(
&mut self,
reader: &mut T,
) -> Result<(), GcovReaderError> {
while let Ok(tag) = reader.read_u32() {
if tag == 0 {
break;
}
let length = reader.read_u32()?;
if tag == GCOV_TAG_FUNCTION {
let identifier = reader.read_u32()?;
let line_checksum = reader.read_u32()?;
let cfg_checksum = if self.version >= 47 {
reader.read_u32()?
} else {
0
};
let name = reader.read_string()?;
let (artificial, file_name, start_line, start_column, end_line, end_column) =
if self.version < 80 {
(0, reader.read_string()?, reader.read_u32()?, 0, 0, 0)
} else {
(
reader.read_u32()?,
reader.read_string()?,
reader.read_u32()?,
reader.read_u32()?,
reader.read_u32()?,
if self.version >= 90 {
reader.read_u32()?
} else {
0
},
)
};
let pos = self.functions.len();
self.functions.push(GcovFunction {
identifier,
start_line,
start_column,
end_line,
end_column,
artificial,
line_checksum,
cfg_checksum,
file_name,
name,
blocks: SmallVec::new(),
edges: SmallVec::new(),
real_edge_count: 0,
lines: FxHashMap::default(),
executed: false,
});
self.ident_to_fun.insert(identifier, pos);
} else if tag == GCOV_TAG_BLOCKS {
let fun = if let Some(fun) = self.functions.last_mut() {
fun
} else {
continue;
};
Gcno::read_blocks(fun, length, self.version, reader)?;
} else if tag == GCOV_TAG_ARCS {
let fun = if let Some(fun) = self.functions.last_mut() {
fun
} else {
continue;
};
Gcno::read_edges(fun, length, reader)?;
} else if tag == GCOV_TAG_LINES {
let fun = if let Some(fun) = self.functions.last_mut() {
fun
} else {
continue;
};
Gcno::read_lines(fun, self.version, reader)?;
}
}
Ok(())
}