Add assembler and disassembler support for the new Armv8.4-a registers for AArch64.
[deliverable/binutils-gdb.git] / gdb / completer.h
index f68c6dcd7121c98a3513feb5b0d653042cf52b6a..38fee6bd62341666f1b0ea007d25352e1e92de12 100644 (file)
@@ -68,6 +68,62 @@ struct match_list_displayer
    calls free on each element.  */
 typedef std::vector<gdb::unique_xmalloc_ptr<char>> completion_list;
 
+/* The result of a successful completion match.  When doing symbol
+   comparison, we use the symbol search name for the symbol name match
+   check, but the matched name that is shown to the user may be
+   different.  For example, Ada uses encoded names for lookup, but
+   then wants to decode the symbol name to show to the user, and also
+   in some cases wrap the matched name in "<sym>" (meaning we can't
+   always use the symbol's print name).  */
+
+class completion_match
+{
+public:
+  /* Get the completion match result.  See m_match/m_storage's
+     descriptions.  */
+  const char *match ()
+  { return m_match; }
+
+  /* Set the completion match result.  See m_match/m_storage's
+     descriptions.  */
+  void set_match (const char *match)
+  { m_match = match; }
+
+  /* Get temporary storage for generating a match result, dynamically.
+     The built string is only good until the next clear() call.  I.e.,
+     good until the next symbol comparison.  */
+  std::string &storage ()
+  { return m_storage; }
+
+  /* Prepare for another completion matching sequence.  */
+  void clear ()
+  {
+    m_match = NULL;
+    m_storage.clear ();
+  }
+
+private:
+  /* The completion match result.  This can either be a pointer into
+     M_STORAGE string, or it can be a pointer into the some other
+     string that outlives the completion matching sequence (usually, a
+     pointer to a symbol's name).  */
+  const char *m_match;
+
+  /* Storage a symbol comparison routine can use for generating a
+     match result, dynamically.  The built string is only good until
+     the next clear() call.  I.e., good until the next symbol
+     comparison.  */
+  std::string m_storage;
+};
+
+/* Convenience aggregate holding info returned by the symbol name
+   matching routines (see symbol_name_matcher_ftype).  */
+struct completion_match_result
+{
+  /* The completion match candidate.  */
+  completion_match match;
+};
+
 /* The final result of a completion that is handed over to either
    readline or the "completion" command (which pretends to be
    readline).  Mainly a wrapper for a readline-style match list array,
@@ -85,9 +141,7 @@ struct completion_result
   /* Destroy a result.  */
   ~completion_result ();
 
-  /* Disable copying, since we don't need it.  */
-  completion_result (const completion_result &rhs) = delete;
-  void operator= (const completion_result &rhs) = delete;
+  DISABLE_COPY_AND_ASSIGN (completion_result);
 
   /* Move a result.  */
   completion_result (completion_result &&rhs);
@@ -146,9 +200,7 @@ public:
   completion_tracker ();
   ~completion_tracker ();
 
-  /* Disable copy.  */
-  completion_tracker (const completion_tracker &rhs) = delete;
-  void operator= (const completion_tracker &rhs) = delete;
+  DISABLE_COPY_AND_ASSIGN (completion_tracker);
 
   /* Add the completion NAME to the list of generated completions if
      it is not there already.  If too many completions were already
@@ -207,6 +259,18 @@ public:
      already have.  */
   bool completes_to_completion_word (const char *word);
 
+  /* Get a reference to the shared (between all the multiple symbol
+     name comparison calls) completion_match_result object, ready for
+     another symbol name match sequence.  */
+  completion_match_result &reset_completion_match_result ()
+  {
+    completion_match_result &res = m_completion_match_result;
+
+    /* Clear any previous match.  */
+    res.match.clear ();
+    return m_completion_match_result;
+  }
+
   /* True if we have any completion match recorded.  */
   bool have_completions () const
   { return !m_entries_vec.empty (); }
@@ -232,6 +296,13 @@ private:
      to hand over to readline.  */
   void recompute_lowest_common_denominator (const char *new_match);
 
+  /* Completion match outputs returned by the symbol name matching
+     routines (see symbol_name_matcher_ftype).  These results are only
+     valid for a single match call.  This is here in order to be able
+     to conveniently share the same storage among all the calls to the
+     symbol name matching routines.  */
+  completion_match_result m_completion_match_result;
+
   /* The completion matches found so far, in a vector.  */
   completion_list m_entries_vec;
 
This page took 0.025694 seconds and 4 git commands to generate.