+/* See completer.h. */
+
+class completion_tracker::completion_hash_entry
+{
+public:
+ /* Constructor. */
+ completion_hash_entry (gdb::unique_xmalloc_ptr<char> name,
+ gdb::unique_xmalloc_ptr<char> lcd)
+ : m_name (std::move (name)),
+ m_lcd (std::move (lcd))
+ {
+ /* Nothing. */
+ }
+
+ /* Returns a pointer to the lowest common denominator string. This
+ string will only be valid while this hash entry is still valid as the
+ string continues to be owned by this hash entry and will be released
+ when this entry is deleted. */
+ char *get_lcd () const
+ {
+ return m_lcd.get ();
+ }
+
+ /* Get, and release the name field from this hash entry. This can only
+ be called once, after which the name field is no longer valid. This
+ should be used to pass ownership of the name to someone else. */
+ char *release_name ()
+ {
+ return m_name.release ();
+ }
+
+ /* Return true of the name in this hash entry is STR. */
+ bool is_name_eq (const char *str) const
+ {
+ return strcmp (m_name.get (), str) == 0;
+ }
+
+ /* Return the hash value based on the name of the entry. */
+ hashval_t hash_name () const
+ {
+ return htab_hash_string (m_name.get ());
+ }
+
+ /* A static function that can be passed to the htab hash system to be
+ used as a callback that deletes an item from the hash. */
+ static void deleter (void *arg)
+ {
+ completion_hash_entry *entry = (completion_hash_entry *) arg;
+ delete entry;
+ }
+
+private:
+
+ /* The symbol name stored in this hash entry. */
+ gdb::unique_xmalloc_ptr<char> m_name;
+
+ /* The lowest common denominator string computed for this hash entry. */
+ gdb::unique_xmalloc_ptr<char> m_lcd;
+};
+