From 67c0a57949358f8e708361ce93ef3ccc0ea8ef93 Mon Sep 17 00:00:00 2001 From: graydon Date: Sat, 23 Jul 2005 02:50:14 +0000 Subject: 2005-07-22 Graydon Hoare * translate.cxx (itervar): New class. (*::visit_foreach_loop): Implement. Various bug fixes. * staptree.cxx (deep_copy_visitor::*): Copy tok fields. * elaborate.cxx (lvalue_aware_traversing_visitor): (mutated_map_collector): (no_map_mutation_during_iteration_check): New classes. (semantic_pass_maps): New function to check map usage. (semantic_pass): Call it. * testsuite/transok/eight.stp: Test 'foreach' loop translation. * testsuite/semko/{thirteen,fourteen,fifteen}.stp: Test prohibited forms of foreach loops. --- testsuite/transok/eight.stp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 testsuite/transok/eight.stp (limited to 'testsuite/transok') diff --git a/testsuite/transok/eight.stp b/testsuite/transok/eight.stp new file mode 100755 index 00000000..e703a5ae --- /dev/null +++ b/testsuite/transok/eight.stp @@ -0,0 +1,30 @@ +#! stap -p3 + +global foo +global baz + +function bar() +{ + return foo["hello"] +} + +probe begin +{ + foo["hello"] = 10 + foreach (a in foo) + { + bar() + } + + baz[1,"hello",a] = "chicken" + baz[1,"goodbye",a] = "supreme" + + foreach ([x,y,z] in baz) + { + printk(baz[x,y,z] . y) + } + + printk("hello from systemtap") +} + + -- cgit