Add completion for operations
[deliverable/binutils-gdb.git] / gdb / parser-defs.h
index 5ff5d52240564fd5c69dc3d7bbe0ddb4ddc47fb3..9f70ff9dca7aa3a005dd9125df65e0f36b723ed8 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "expression.h"
 #include "symtab.h"
+#include "expop.h"
 
 struct block;
 struct language_defn;
@@ -63,6 +64,13 @@ struct expr_builder
     return expout->language_defn;
   }
 
+  /* Set the root operation of the expression that is currently being
+     built.  */
+  void set_operation (expr::operation_up &&op)
+  {
+    expout->op = std::move (op);
+  }
+
   /* The size of the expression above.  */
 
   size_t expout_size;
@@ -86,6 +94,11 @@ struct expr_completion_state
      field name.  It is -1 if no dereference operation was found.  */
   int expout_last_struct = -1;
 
+  /* The last struct expression directly before a '.' or '->'.  This
+     is set when parsing and is only used when completing a field
+     name.  It is nullptr if no dereference operation was found.  */
+  expr::structop_base_operation *expout_last_op = nullptr;
+
   /* If we are completing a tagged type name, this will be nonzero.  */
   enum type_code expout_tag_completion_type = TYPE_CODE_UNDEF;
 
@@ -149,6 +162,11 @@ struct parser_state : public expr_builder
 
   void mark_struct_expression ();
 
+  /* Mark the given operation as the starting location of a structure
+     expression.  This is used when completing on field names.  */
+
+  void mark_struct_expression (expr::structop_base_operation *op);
+
   /* Indicate that the current parser invocation is completing a tag.
      TAG is the type code of the tag, and PTR and LENGTH represent the
      start of the tag name.  */
@@ -334,6 +352,16 @@ extern void write_exp_msymbol (struct expr_builder *,
 
 extern void write_dollar_variable (struct parser_state *, struct stoken str);
 
+/* Write a reference to a symbol to the expression being built in PS.
+   NAME is the name of the symbol to write; SYM is the symbol.  If SYM
+   is nullptr (meaning the 'symbol' member), a minimal symbol will be
+   searched for and used if available.  Throws an exception if SYM is
+   nullptr and no minimal symbol can be found.  */
+
+extern void write_exp_symbol_reference (struct parser_state *ps,
+                                       const char *name,
+                                       struct block_symbol sym);
+
 extern const char *find_template_name_end (const char *);
 
 extern std::string copy_name (struct stoken);
This page took 0.026489 seconds and 4 git commands to generate.