From 330e56a14e591af6299eec7f9f6d9df56037e0cb Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Wed, 1 Jul 2020 15:40:15 -0400
Subject: [PATCH 272/315] FIXME: remove __analyzer_dump_num_heap_regions

---
 gcc/analyzer/region-model2.cc                 | 19 ------
 .../gcc.dg/analyzer/analyzer-decls.h          |  2 -
 gcc/testsuite/gcc.dg/analyzer/data-model-5d.c | 64 -------------------
 gcc/testsuite/gcc.dg/analyzer/data-model-6.c  | 14 ----
 4 files changed, 99 deletions(-)
 delete mode 100644 gcc/testsuite/gcc.dg/analyzer/data-model-5d.c
 delete mode 100644 gcc/testsuite/gcc.dg/analyzer/data-model-6.c

diff --git a/gcc/analyzer/region-model2.cc b/gcc/analyzer/region-model2.cc
index f7a1ce72c9b..0fdab11b962 100644
--- a/gcc/analyzer/region-model2.cc
+++ b/gcc/analyzer/region-model2.cc
@@ -4977,25 +4977,6 @@ region_model2::on_call_pre (const gcall *call, region_model2_context *ctxt)
 	  if (impl_call_strlen (cd))
 	    return false;
 	}
-      else if (is_named_call_p (callee_fndecl,
-				"__analyzer_dump_num_heap_region2s", call, 0))
-	{
-#if 0
-	  /* Handle the builtin "__analyzer_dump_num_heap_region2s" by emitting
-	     a warning (for use in DejaGnu tests).  */
-	  int num_heap_region2s = 0;
-	  region2 *heap_reg = get_root_region2 ()->ensure_heap_region2 (this);
-	  unsigned i;
-	  region2 *region2;
-	  FOR_EACH_VEC_ELT (m_region2s, i, region2)
-	    if (region2->get_parent () == heap_reg)
-	      num_heap_region2s++;
-	  /* Use quotes to ensure the output isn't truncated.  */
-	  warning_at (call->location, 0,
-		      "num heap region2s: %qi", num_heap_region2s);
-	  return false;
-#endif
-	}
       else if (!fndecl_has_gimple_body_p (callee_fndecl)
 	       && !DECL_PURE_P (callee_fndecl)
 	       && !fndecl_built_in_p (callee_fndecl))
diff --git a/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h b/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h
index bd09de57acb..0a7ede08353 100644
--- a/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h
+++ b/gcc/testsuite/gcc.dg/analyzer/analyzer-decls.h
@@ -24,8 +24,6 @@ extern void __analyzer_dump (void);
    will also dump all of the states within those nodes.  */
 extern void __analyzer_dump_exploded_nodes (int);
 
-extern void __analyzer_dump_num_heap_regions (void);
-
 /* Emit a placeholder "note" diagnostic with a path to this call site,
    if the analyzer finds a feasible path to it.  */
 extern void __analyzer_dump_path (void);
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-5d.c b/gcc/testsuite/gcc.dg/analyzer/data-model-5d.c
deleted file mode 100644
index 8c7bfa91a96..00000000000
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-5d.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* A toy re-implementation of CPython's object model.  */
-
-#include <stddef.h>
-#include <string.h>
-#include <stdlib.h>
-#include "analyzer-decls.h"
-
-typedef struct base_obj base_obj;
-typedef struct type_obj type_obj;
-typedef struct string_obj string_obj;
-
-struct base_obj
-{
-  struct type_obj *ob_type;
-  int ob_refcnt;
-};
-
-struct type_obj
-{
-  base_obj tp_base;
-};
-
-struct string_obj
-{
-  base_obj str_base;
-  size_t str_len;
-  char str_buf[];
-};
-
-type_obj type_type = {
-  { &type_type, 1},
-};
-
-type_obj str_type = {
-  { &str_type, 1},
-};
-
-base_obj *alloc_obj (type_obj *ob_type, size_t sz)
-{
-  base_obj *obj = (base_obj *)malloc (sz);
-  if (!obj)
-    return NULL;
-  obj->ob_type = ob_type;
-  obj->ob_refcnt = 1;
-  return obj;
-}
-
-void unref (base_obj *obj)
-{
-  //__analyzer_dump();
-  if (--obj->ob_refcnt == 0)
-    free (obj);
-}
-
-void test_1 ()
-{
-  base_obj *obj = alloc_obj (&str_type, sizeof (string_obj));
-  if (obj)
-    {
-      __analyzer_dump_num_heap_regions (); /* { dg-warning "num heap regions: '1'" } */
-      unref (obj);
-      __analyzer_dump_num_heap_regions (); /* { dg-warning "num heap regions: '0'" } */
-    }
-}
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-6.c b/gcc/testsuite/gcc.dg/analyzer/data-model-6.c
deleted file mode 100644
index 78a797ead76..00000000000
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-6.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdlib.h>
-#include "analyzer-decls.h"
-
-/* Verify that we don't accumulate state after a malloc/free pair.  */
-
-void test (void)
-{
-  void *ptr;
-  __analyzer_dump_num_heap_regions (); /* { dg-warning "num heap regions: '0'" } */
-  ptr = malloc (1024);
-  __analyzer_dump_num_heap_regions (); /* { dg-warning "num heap regions: '1'" } */
-  free (ptr);
-  __analyzer_dump_num_heap_regions (); /* { dg-warning "num heap regions: '0'" } */
-}
-- 
2.26.2

