diff options
author | David Malcolm <dmalcolm@redhat.com> | 2019-12-13 19:47:47 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-01-14 18:24:56 -0500 |
commit | f474fbd5e3cca37ebc886a4950827e93d1c665c8 (patch) | |
tree | 61e375e8917b9f721bdc7c25e1a370819d689cd8 /gcc | |
parent | ddd792fa53345180c782494aa597e438a73b6248 (diff) | |
download | gcc-f474fbd5e3cca37ebc886a4950827e93d1c665c8.zip gcc-f474fbd5e3cca37ebc886a4950827e93d1c665c8.tar.gz gcc-f474fbd5e3cca37ebc886a4950827e93d1c665c8.tar.bz2 |
analyzer: better logging for dedupe_winners::add
gcc/analyzer/ChangeLog:
* diagnostic-manager.cc (dedupe_winners::add): Add logging
of deduplication decisions made.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/analyzer/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/analyzer/diagnostic-manager.cc | 23 |
2 files changed, 25 insertions, 3 deletions
diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index 6841243..4fe354a 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,5 +1,10 @@ 2020-01-14 David Malcolm <dmalcolm@redhat.com> + * diagnostic-manager.cc (dedupe_winners::add): Add logging + of deduplication decisions made. + +2020-01-14 David Malcolm <dmalcolm@redhat.com> + * ChangeLog: New file. * analyzer-selftests.cc: New file. * analyzer-selftests.h: New file. diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc index cd2c3bf..7bd21d6 100644 --- a/gcc/analyzer/diagnostic-manager.cc +++ b/gcc/analyzer/diagnostic-manager.cc @@ -325,12 +325,19 @@ public: dedupe_key *key = new dedupe_key (sd, dc->get_path ()); if (dedupe_candidate **slot = m_map.get (key)) { + if (logger) + logger->log ("already have this dedupe_key"); + (*slot)->add_duplicate (); if (dc->length () < (*slot)->length ()) { /* We've got a shorter path for the key; replace the current candidate. */ + if (logger) + logger->log ("length %i is better than existing length %i;" + " taking over this dedupe_key", + dc->length (), (*slot)->length ()); dc->m_num_dupes = (*slot)->get_num_dupes (); delete *slot; *slot = dc; @@ -338,12 +345,22 @@ public: else /* We haven't beaten the current best candidate; drop the new candidate. */ - delete dc; + { + if (logger) + logger->log ("length %i isn't better than existing length %i;" + " dropping this candidate", + dc->length (), (*slot)->length ()); + delete dc; + } delete key; } else - /* This is the first candidate for this key. */ - m_map.put (key, dc); + { + /* This is the first candidate for this key. */ + m_map.put (key, dc); + if (logger) + logger->log ("first candidate for this dedupe_key"); + } } /* Emit the simplest diagnostic within each set. */ |