[2/2] analyzer: add empty_zero_p for the various hash traits

Message ID 20200114045154.19021-2-dmalcolm@redhat.com
State New
Headers show
Series
  • [1/2] hash-table.h: support non-zero empty values in empty_slow (v2)
Related show

Commit Message

David Malcolm Jan. 14, 2020, 4:51 a.m.
Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu

OK for master?

gcc/analyzer/ChangeLog:
	* diagnostic-manager.cc (dedupe_hash_map_traits::empty_zero_p):
	New static constant.
	* engine.cc
	(default_hash_traits<function_call_string>::empty_zero_p): Likewise.
	* exploded-graph.h (eg_hash_map_traits::empty_zero_p): Likewise.
	(eg_point_hash_map_traits::empty_zero_p): Likewise.
	(eg_call_string_hash_map_traits::empty_zero_p): Likewise.
	* program-state.h (default_hash_traits<svalue_id>::empty_zero_p):
	Likewise.
	* state-purge.h
	(default_hash_traits<function_point>::empty_zero_p): Likewise.
---
 gcc/analyzer/diagnostic-manager.cc | 2 +-
 gcc/analyzer/engine.cc             | 1 +
 gcc/analyzer/exploded-graph.h      | 3 +++
 gcc/analyzer/program-state.h       | 1 +
 gcc/analyzer/state-purge.h         | 1 +
 5 files changed, 7 insertions(+), 1 deletion(-)

-- 
2.21.0

Patch

diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc
index 12b8e5a4ac4..cd2c3bf2076 100644
--- a/gcc/analyzer/diagnostic-manager.cc
+++ b/gcc/analyzer/diagnostic-manager.cc
@@ -265,7 +265,7 @@  public:
   {
     return entry.m_key == NULL;
   }
-
+  static const bool empty_zero_p = true;
 };
 
 /* A class for deduplicating diagnostics and finding (and emitting) the
diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index 3e3d8a120b7..720fa219d16 100644
--- a/gcc/analyzer/engine.cc
+++ b/gcc/analyzer/engine.cc
@@ -2913,6 +2913,7 @@  struct function_call_string
 template <> struct default_hash_traits<function_call_string>
 : public pod_hash_traits<function_call_string>
 {
+  static const bool empty_zero_p = false;
 };
 
 template <>
diff --git a/gcc/analyzer/exploded-graph.h b/gcc/analyzer/exploded-graph.h
index ddc5e06b3b6..8c29e552cac 100644
--- a/gcc/analyzer/exploded-graph.h
+++ b/gcc/analyzer/exploded-graph.h
@@ -407,6 +407,7 @@  struct eg_hash_map_traits
   {
     return entry.m_key == NULL;
   }
+  static const bool empty_zero_p = false;
 };
 
 /* Per-program_point data for an exploded_graph.  */
@@ -473,6 +474,7 @@  struct eg_point_hash_map_traits
   {
     return entry.m_key == NULL;
   }
+  static const bool empty_zero_p = false;
 };
 
 /* Data about a particular call_string within an exploded_graph.  */
@@ -539,6 +541,7 @@  struct eg_call_string_hash_map_traits
   {
     return entry.m_key == NULL;
   }
+  static const bool empty_zero_p = false;
 };
 
 /* Data about a particular function within an exploded_graph.  */
diff --git a/gcc/analyzer/program-state.h b/gcc/analyzer/program-state.h
index 37fb7cc4101..75b65b780c9 100644
--- a/gcc/analyzer/program-state.h
+++ b/gcc/analyzer/program-state.h
@@ -50,6 +50,7 @@  public:
 template <> struct default_hash_traits<svalue_id>
 : public pod_hash_traits<svalue_id>
 {
+  static const bool empty_zero_p = false;
 };
 
 template <>
diff --git a/gcc/analyzer/state-purge.h b/gcc/analyzer/state-purge.h
index 77b7f622bbd..e33733a6cc5 100644
--- a/gcc/analyzer/state-purge.h
+++ b/gcc/analyzer/state-purge.h
@@ -26,6 +26,7 @@  along with GCC; see the file COPYING3.  If not see
 template <> struct default_hash_traits<function_point>
 : public pod_hash_traits<function_point>
 {
+  static const bool empty_zero_p = false;
 };
 
 template <>