summaryrefslogtreecommitdiffstats
path: root/staptree.h
diff options
context:
space:
mode:
Diffstat (limited to 'staptree.h')
-rw-r--r--staptree.h29
1 files changed, 27 insertions, 2 deletions
diff --git a/staptree.h b/staptree.h
index 16f0256a..146d0e34 100644
--- a/staptree.h
+++ b/staptree.h
@@ -58,6 +58,7 @@ std::ostream& operator << (std::ostream& o, const exp_type& e);
struct token;
struct visitor;
+struct update_visitor;
struct expression
{
@@ -227,18 +228,42 @@ struct target_symbol: public symbol
enum component_type
{
comp_struct_member,
- comp_literal_array_index
+ comp_literal_array_index,
+ comp_expression_array_index,
};
+
+ struct component
+ {
+ const token* tok;
+ component_type type;
+ std::string member; // comp_struct_member
+ int64_t num_index; // comp_literal_array_index
+ expression* expr_index; // comp_expression_array_index
+
+ component(const token* t, const std::string& m):
+ tok(t), type(comp_struct_member), member(m) {}
+ component(const token* t, int64_t n):
+ tok(t), type(comp_literal_array_index), num_index(n) {}
+ component(const token* t, expression* e):
+ tok(t), type(comp_expression_array_index), expr_index(e) {}
+ void print (std::ostream& o) const;
+ };
+
bool addressof;
std::string base_name;
- std::vector<std::pair<component_type, std::string> > components;
+ std::vector<component> components;
std::string probe_context_var;
semantic_error* saved_conversion_error;
target_symbol(): addressof(false), saved_conversion_error (0) {}
void print (std::ostream& o) const;
void visit (visitor* u);
+ void visit_components (visitor* u);
+ void visit_components (update_visitor* u);
+ void assert_no_components(const std::string& tapset);
};
+std::ostream& operator << (std::ostream& o, const target_symbol::component& c);
+
struct cast_op: public target_symbol
{