aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile/compile-internal.h
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2018-08-10 10:53:47 -0700
committerKeith Seitz <keiths@redhat.com>2018-08-10 11:14:25 -0700
commit0cfbf43085c4191f3f4b4b4a834f1e19bf42d4a9 (patch)
tree3ce376cc5de9974010c884076fdb127014aeed28 /gdb/compile/compile-internal.h
parent946d3d10e7609e074be30db8662cb9c4a3d8961d (diff)
downloadbinutils-0cfbf43085c4191f3f4b4b4a834f1e19bf42d4a9.zip
binutils-0cfbf43085c4191f3f4b4b4a834f1e19bf42d4a9.tar.gz
binutils-0cfbf43085c4191f3f4b4b4a834f1e19bf42d4a9.tar.bz2
Use unique_ptr for htabs
This patch updates the type-conversion caching in C compile to use unique pointers. This patch also removes the on-demand allocation of the symbol error map in favor of initialization, simplifying the code. gdb/ChangeLog * compile/compile-internal.h (compile_instance::~compile_instance): Remove calls to htab_delete. <m_type_map, m_symbol_err_map>: Switch type to htab_up. * compile.c (compile_instance::compile_instance): Initialize htab unique pointers. (compile_instance::get_cached_type, compile_instance::insert_type) (compile_instance::error_symbol_once): Update for unique_ptr.
Diffstat (limited to 'gdb/compile/compile-internal.h')
-rw-r--r--gdb/compile/compile-internal.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/gdb/compile/compile-internal.h b/gdb/compile/compile-internal.h
index 3916f84..c8d2d2f 100644
--- a/gdb/compile/compile-internal.h
+++ b/gdb/compile/compile-internal.h
@@ -49,9 +49,6 @@ public:
virtual ~compile_instance ()
{
m_gcc_fe->ops->destroy (m_gcc_fe);
- htab_delete (m_type_map);
- if (m_symbol_err_map != NULL)
- htab_delete (m_symbol_err_map);
}
/* Returns the GCC options to be passed during compilation. */
@@ -148,10 +145,10 @@ protected:
std::string m_gcc_target_options;
/* Map from gdb types to gcc types. */
- htab_t m_type_map;
+ htab_up m_type_map;
/* Map from gdb symbols to gcc error messages to emit. */
- htab_t m_symbol_err_map;
+ htab_up m_symbol_err_map;
};
/* Define header and footers for different scopes. */