Update flatten_inlines to properly move inline frames instead of copying them and also clarify a comment

This commit is contained in:
Jeremy 2024-06-04 23:21:14 -05:00
parent 72b0e467d7
commit 8d7a85c447
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4

View File

@ -44,8 +44,7 @@ namespace libdwarf {
// .emplace needed, for some reason .insert tries to copy <= gcc 7.2
return resolver_map.emplace(object_name, std::move(resolver_object)).first->second.get();
} else {
// gcc cannot handle the following logic properly in <= gcc 5.1, so the type to be constructed is explicitly specified.
// See also:https://godbolt.org/z/9oWdWjbf8
// gcc 4 has trouble with automatic moves of locals here https://godbolt.org/z/9oWdWjbf8
return maybe_owned<symbol_resolver>{std::move(resolver_object)};
}
}
@ -54,7 +53,7 @@ namespace libdwarf {
// flatten trace with inlines
std::vector<stacktrace_frame> flatten_inlines(std::vector<frame_with_inlines>& trace) {
std::vector<stacktrace_frame> final_trace;
for(const auto& entry : trace) {
for(auto& entry : trace) {
// most recent call first
if(!entry.inlines.empty()) {
// insert in reverse order