public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ibm/heads/perf)] analyzer: introduce noop_region_model_context
@ 2020-03-19 6:26 Jiu Fu Guo
0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-03-19 6:26 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:7d9c107ab1eab331e7011513b11e26b78850d614
commit 7d9c107ab1eab331e7011513b11e26b78850d614
Author: David Malcolm <dmalcolm@redhat.com>
Date: Tue Mar 17 14:43:43 2020 -0400
analyzer: introduce noop_region_model_context
tentative_region_model_context and test_region_model_context are both
forced to implement numerous pure virtual vfuncs of the abstract
region_model_context.
This patch adds a noop_region_model_context which provides empty
implementations of all of region_model_context's pure virtual functions,
and subclasses the above classes from that, rather than from
region_model_context directly.
gcc/analyzer/ChangeLog:
* region-model.h (class noop_region_model_context): New subclass
of region_model_context.
(class tentative_region_model_context): Inherit from
noop_region_model_context rather than from region_model_context;
drop redundant vfunc implementations.
(class test_region_model_context): Likewise.
Diff:
---
gcc/analyzer/ChangeLog | 9 +++++
gcc/analyzer/region-model.h | 84 +++++++++++++--------------------------------
2 files changed, 32 insertions(+), 61 deletions(-)
diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog
index ace456c02d8..110a845edc8 100644
--- a/gcc/analyzer/ChangeLog
+++ b/gcc/analyzer/ChangeLog
@@ -1,3 +1,12 @@
+2020-03-18 David Malcolm <dmalcolm@redhat.com>
+
+ * region-model.h (class noop_region_model_context): New subclass
+ of region_model_context.
+ (class tentative_region_model_context): Inherit from
+ noop_region_model_context rather than from region_model_context;
+ drop redundant vfunc implementations.
+ (class test_region_model_context): Likewise.
+
2020-03-18 David Malcolm <dmalcolm@redhat.com>
* engine.cc (exploded_node::exploded_node): Move implementation
diff --git a/gcc/analyzer/region-model.h b/gcc/analyzer/region-model.h
index c1fe592e30c..035b611b813 100644
--- a/gcc/analyzer/region-model.h
+++ b/gcc/analyzer/region-model.h
@@ -1972,42 +1972,50 @@ class region_model_context
const dump_location_t &loc) = 0;
};
-/* A subclass of region_model_context for determining if operations fail
- e.g. "can we generate a region for the lvalue of EXPR?". */
+/* A "do nothing" subclass of region_model_context. */
-class tentative_region_model_context : public region_model_context
+class noop_region_model_context : public region_model_context
{
public:
- tentative_region_model_context () : m_num_unexpected_codes (0) {}
-
- void warn (pending_diagnostic *) FINAL OVERRIDE {}
- void remap_svalue_ids (const svalue_id_map &) FINAL OVERRIDE {}
- int on_svalue_purge (svalue_id, const svalue_id_map &) FINAL OVERRIDE
+ void warn (pending_diagnostic *) OVERRIDE {}
+ void remap_svalue_ids (const svalue_id_map &) OVERRIDE {}
+ int on_svalue_purge (svalue_id, const svalue_id_map &) OVERRIDE
{
return 0;
}
- logger *get_logger () FINAL OVERRIDE { return NULL; }
+ logger *get_logger () OVERRIDE { return NULL; }
void on_inherited_svalue (svalue_id parent_sid ATTRIBUTE_UNUSED,
svalue_id child_sid ATTRIBUTE_UNUSED)
- FINAL OVERRIDE
+ OVERRIDE
{
}
void on_cast (svalue_id src_sid ATTRIBUTE_UNUSED,
- svalue_id dst_sid ATTRIBUTE_UNUSED) FINAL OVERRIDE
+ svalue_id dst_sid ATTRIBUTE_UNUSED) OVERRIDE
{
}
void on_condition (tree lhs ATTRIBUTE_UNUSED,
enum tree_code op ATTRIBUTE_UNUSED,
- tree rhs ATTRIBUTE_UNUSED) FINAL OVERRIDE
+ tree rhs ATTRIBUTE_UNUSED) OVERRIDE
{
}
- void on_unknown_change (svalue_id sid ATTRIBUTE_UNUSED) FINAL OVERRIDE
+ void on_unknown_change (svalue_id sid ATTRIBUTE_UNUSED) OVERRIDE
{
}
void on_phi (const gphi *phi ATTRIBUTE_UNUSED,
- tree rhs ATTRIBUTE_UNUSED) FINAL OVERRIDE
+ tree rhs ATTRIBUTE_UNUSED) OVERRIDE
{
}
+ void on_unexpected_tree_code (tree, const dump_location_t &) OVERRIDE {}
+};
+
+/* A subclass of region_model_context for determining if operations fail
+ e.g. "can we generate a region for the lvalue of EXPR?". */
+
+class tentative_region_model_context : public noop_region_model_context
+{
+public:
+ tentative_region_model_context () : m_num_unexpected_codes (0) {}
+
void on_unexpected_tree_code (tree, const dump_location_t &)
FINAL OVERRIDE
{
@@ -2143,7 +2151,7 @@ using namespace ::selftest;
/* An implementation of region_model_context for use in selftests, which
stores any pending_diagnostic instances passed to it. */
-class test_region_model_context : public region_model_context
+class test_region_model_context : public noop_region_model_context
{
public:
void warn (pending_diagnostic *d) FINAL OVERRIDE
@@ -2151,54 +2159,8 @@ public:
m_diagnostics.safe_push (d);
}
- void remap_svalue_ids (const svalue_id_map &) FINAL OVERRIDE
- {
- /* Empty. */
- }
-
-#if 0
- bool can_purge_p (svalue_id) FINAL OVERRIDE
- {
- return true;
- }
-#endif
-
- int on_svalue_purge (svalue_id, const svalue_id_map &) FINAL OVERRIDE
- {
- /* Empty. */
- return 0;
- }
-
- logger *get_logger () FINAL OVERRIDE { return NULL; }
-
- void on_inherited_svalue (svalue_id parent_sid ATTRIBUTE_UNUSED,
- svalue_id child_sid ATTRIBUTE_UNUSED)
- FINAL OVERRIDE
- {
- }
-
- void on_cast (svalue_id src_sid ATTRIBUTE_UNUSED,
- svalue_id dst_sid ATTRIBUTE_UNUSED) FINAL OVERRIDE
- {
- }
-
unsigned get_num_diagnostics () const { return m_diagnostics.length (); }
- void on_condition (tree lhs ATTRIBUTE_UNUSED,
- enum tree_code op ATTRIBUTE_UNUSED,
- tree rhs ATTRIBUTE_UNUSED) FINAL OVERRIDE
- {
- }
-
- void on_unknown_change (svalue_id sid ATTRIBUTE_UNUSED) FINAL OVERRIDE
- {
- }
-
- void on_phi (const gphi *phi ATTRIBUTE_UNUSED,
- tree rhs ATTRIBUTE_UNUSED) FINAL OVERRIDE
- {
- }
-
void on_unexpected_tree_code (tree t, const dump_location_t &)
FINAL OVERRIDE
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-03-19 6:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 6:26 [gcc(refs/vendors/ibm/heads/perf)] analyzer: introduce noop_region_model_context Jiu Fu Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).