c++: Adjust pushdecl/duplicate_decls API
[gcc.git] / gcc / context.c
index 698cc579518fd3760d7f23eb9f8b2707b56ea265..0ec49d885c0d97946380312caf86040ea709b2f8 100644 (file)
@@ -1,5 +1,5 @@
 /* context.c - Holder for global state
-   Copyright (C) 2013 Free Software Foundation, Inc.
+   Copyright (C) 2013-2020 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -20,40 +20,25 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "ggc.h"
 #include "context.h"
 #include "pass_manager.h"
+#include "dumpfile.h"
+#include "realmpfr.h"
 
 /* The singleton holder of global state: */
 gcc::context *g;
 
-void *
-gcc::context::operator new (std::size_t size)
+gcc::context::context ()
+  : m_passes (NULL), m_dumps (new gcc::dump_manager ())
 {
-  return ggc_internal_cleared_alloc_stat (size MEM_STAT_INFO);
+  have_offload = false;
 }
 
-gcc::context::context()
+gcc::context::~context ()
 {
-  passes_ = new gcc::pass_manager (this);
-}
-
-/* Functions relating to the garbage collector.  */
-void
-gcc::context::gt_ggc_mx ()
-{
-  ::gt_ggc_mx (passes_);
-}
+  delete m_passes;
+  delete m_dumps;
 
-void
-gcc::context::gt_pch_nx ()
-{
-  ::gt_pch_nx (passes_);
-}
-
-void
-gcc::context::gt_pch_nx (gt_pointer_operator op ATTRIBUTE_UNUSED,
-                        void *cookie ATTRIBUTE_UNUSED)
-{
-  op (&passes_, cookie);
+  /* Release MPFR caches to avoid Valgrind leak reports.  */
+  mpfr_free_cache ();
 }