summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2010-02-23 20:38:56 -0500
committerFrank Ch. Eigler <fche@elastic.org>2010-02-23 20:38:56 -0500
commitc7005ee1ba902de01a8863661a2031bfd45d3d40 (patch)
treee8a7bfa55c9afcfac71b5aafa5b54256f356c81a /tapsets.cxx
parent30263a7389d5c2712536b74656193708bbc64d49 (diff)
parent10328bcf86d49e5de83c5b22890204b5874740a9 (diff)
downloadsystemtap-steved-c7005ee1ba902de01a8863661a2031bfd45d3d40.tar.gz
systemtap-steved-c7005ee1ba902de01a8863661a2031bfd45d3d40.tar.xz
systemtap-steved-c7005ee1ba902de01a8863661a2031bfd45d3d40.zip
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
* 'master' of ssh://sources.redhat.com/git/systemtap: PR10719 part 1: Partial constant folding Simplify null_statement construction Fixed PR 11269 by properly handling mmap syscall 'fd' argument. Removed rvalue operator check. PR 10690 (partial fix). Handle '.=' operator in procfs probes. Conflicts: tapsets.h
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx36
1 files changed, 30 insertions, 6 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 097cddc8..fcb22e03 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -1859,6 +1859,19 @@ private:
unsigned var_expanding_visitor::tick = 0;
+
+var_expanding_visitor::var_expanding_visitor ()
+{
+ // FIXME: for the time being, by default we only support plain '$foo
+ // = bar', not '+=' or any other op= variant. This is fixable, but a
+ // bit ugly.
+ //
+ // If derived classes desire to add additional operator support, add
+ // new operators to this list in the derived class constructor.
+ valid_ops.insert ("=");
+}
+
+
void
var_expanding_visitor::visit_assignment (assignment* e)
{
@@ -1877,6 +1890,9 @@ var_expanding_visitor::visit_assignment (assignment* e)
functioncall *fcall = NULL;
expression *new_left, *new_right;
+ // Let visit_target_symbol know what operator it should handle.
+ op = &e->op;
+
target_symbol_setter_functioncalls.push (&fcall);
new_left = require (e->left);
target_symbol_setter_functioncalls.pop ();
@@ -1890,12 +1906,20 @@ var_expanding_visitor::visit_assignment (assignment* e)
// right child spliced in as sole argument -- in place of
// ourselves, in the var expansion we're in the middle of making.
- // FIXME: for the time being, we only support plan $foo = bar,
- // not += or any other op= variant. This is fixable, but a bit
- // ugly.
- if (e->op != "=")
- throw semantic_error ("Operator-assign expressions on target "
- "variables not implemented", e->tok);
+ if (valid_ops.find (e->op) == valid_ops.end ())
+ {
+ // Build up a list of supported operators.
+ string ops;
+ std::set<string>::iterator i;
+ for (i = valid_ops.begin(); i != valid_ops.end(); i++)
+ ops += " " + *i + ",";
+ ops.resize(ops.size() - 1); // chop off the last ','
+
+ // Throw the error.
+ throw semantic_error ("Only the following assign operators are"
+ " implemented on target variables:" + ops,
+ e->tok);
+ }
assert (new_left == fcall);
fcall->args.push_back (new_right);