[1/3] abidw: fix --stats output for resolved classes and enums
Commit Message
The code to print out the remaining declaration-only types
unintentionally omitted the first such type. This change fixes the
logic and uses a single test to decide whether or not to print the
stats header line.
* src/abg-dwarf-reader.cc
(read_context::resolve_declaration_only_classes): Fix
conditional logic so that showing stats includes the first
unresolved type.
(read_context::resolve_declaration_only_enums): Likewise.
Signed-off-by: Giuliano Procida <gprocida@google.com>
---
src/abg-dwarf-reader.cc | 40 ++++++++++++++++------------------------
1 file changed, 16 insertions(+), 24 deletions(-)
Comments
Giuliano Procida <gprocida@google.com> a écrit:
> The code to print out the remaining declaration-only types
> unintentionally omitted the first such type. This change fixes the
> logic and uses a single test to decide whether or not to print the
> stats header line.
>
> * src/abg-dwarf-reader.cc
> (read_context::resolve_declaration_only_classes): Fix
> conditional logic so that showing stats includes the first
> unresolved type.
> (read_context::resolve_declaration_only_enums): Likewise.
>
> Signed-off-by: Giuliano Procida <gprocida@google.com>
Applied to master, thanks!
Cheers,
[...]
@@ -4325,19 +4325,15 @@ public:
++i)
declaration_only_classes().erase(*i);
- for (string_classes_map::iterator i = declaration_only_classes().begin();
- i != declaration_only_classes().end();
- ++i)
+ if (show_stats() && !declaration_only_classes().empty())
{
- if (show_stats())
- {
- if (i == declaration_only_classes().begin())
- cerr << "Here are the "
- << num_decl_only_classes - num_resolved
- << " unresolved class declarations:\n";
- else
- cerr << " " << i->first << "\n";
- }
+ cerr << "Here are the "
+ << num_decl_only_classes - num_resolved
+ << " unresolved class declarations:\n";
+ for (string_classes_map::iterator i = declaration_only_classes().begin();
+ i != declaration_only_classes().end();
+ ++i)
+ cerr << " " << i->first << "\n";
}
}
@@ -4527,19 +4523,15 @@ public:
++i)
declaration_only_enums().erase(*i);
- for (string_enums_map::iterator i = declaration_only_enums().begin();
- i != declaration_only_enums().end();
- ++i)
+ if (show_stats() && !declaration_only_enums().empty())
{
- if (show_stats())
- {
- if (i == declaration_only_enums().begin())
- cerr << "Here are the "
- << num_decl_only_enums - num_resolved
- << " unresolved enum declarations:\n";
- else
- cerr << " " << i->first << "\n";
- }
+ cerr << "Here are the "
+ << num_decl_only_enums - num_resolved
+ << " unresolved enum declarations:\n";
+ for (string_enums_map::iterator i = declaration_only_enums().begin();
+ i != declaration_only_enums().end();
+ ++i)
+ cerr << " " << i->first << "\n";
}
}