c++: Adjust pushdecl/duplicate_decls API
[gcc.git] / gcc / context.c
index d132946eebf3b66112b5c818f6f16af0b0e8cb51..0ec49d885c0d97946380312caf86040ea709b2f8 100644 (file)
@@ -1,5 +1,5 @@
 /* context.c - Holder for global state
-   Copyright (C) 2013-2014 Free Software Foundation, Inc.
+   Copyright (C) 2013-2020 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -20,27 +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;
 
 gcc::context::context ()
+  : m_passes (NULL), m_dumps (new gcc::dump_manager ())
 {
   have_offload = false;
-
-  /* The pass manager's constructor uses the dump manager (to set up
-     dumps for the various passes), so the dump manager must be set up
-     before the pass manager.  */
-  m_dumps = new gcc::dump_manager ();
-  m_passes = new gcc::pass_manager (this);
 }
 
 gcc::context::~context ()
 {
   delete m_passes;
   delete m_dumps;
+
+  /* Release MPFR caches to avoid Valgrind leak reports.  */
+  mpfr_free_cache ();
 }