aboutsummaryrefslogtreecommitdiff
path: root/gcc/system.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2021-01-29 15:12:24 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2021-01-29 15:12:24 -0500
commiteb06fdd424bf66e0245295b75f22316743d86251 (patch)
tree3a06559e68cbf2a5ddd0e08cdeaaf5156fa9f20a /gcc/system.h
parent7f9f83ef300e8734dccb90a7c347997b2787e9e9 (diff)
downloadgcc-eb06fdd424bf66e0245295b75f22316743d86251.zip
gcc-eb06fdd424bf66e0245295b75f22316743d86251.tar.gz
gcc-eb06fdd424bf66e0245295b75f22316743d86251.tar.bz2
analyzer: consolidate conditionals in paths
This patch adds a simplification to analyzer paths for repeated CFG edges generated from compound conditionals. For example, it simplifies: | 5 | if (a && b && c) | | ^~~~~~~~~~~~ | | | | | | | | | (4) ...to here | | | | (5) following ‘true’ branch (when ‘c != 0’)... | | | (2) ...to here | | | (3) following ‘true’ branch (when ‘b != 0’)... | | (1) following ‘true’ branch (when ‘a != 0’)... | 6 | __analyzer_dump_path (); | | ~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (6) ...to here to: | 5 | if (a && b && c) | | ^ | | | | | (1) following ‘true’ branch... | 6 | __analyzer_dump_path (); | | ~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) ...to here gcc/analyzer/ChangeLog: * checker-path.cc (event_kind_to_string): Handle EK_START_CONSOLIDATED_CFG_EDGES and EK_END_CONSOLIDATED_CFG_EDGES. (start_consolidated_cfg_edges_event::get_desc): New. (checker_path::cfg_edge_pair_at_p): New. * checker-path.h (enum event_kind): Add EK_START_CONSOLIDATED_CFG_EDGES and EK_END_CONSOLIDATED_CFG_EDGES. (class start_consolidated_cfg_edges_event): New class. (class end_consolidated_cfg_edges_event): New class. (checker_path::delete_events): New. (checker_path::replace_event): New. (checker_path::cfg_edge_pair_at_p): New decl. * diagnostic-manager.cc (diagnostic_manager::prune_path): Call consolidate_conditions. (same_line_as_p): New. (diagnostic_manager::consolidate_conditions): New. * diagnostic-manager.h (diagnostic_manager::consolidate_conditions): New decl. gcc/testsuite/ChangeLog: * gcc.dg/analyzer/combined-conditionals-1.c: New test.
Diffstat (limited to 'gcc/system.h')
0 files changed, 0 insertions, 0 deletions