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/semko/fifteen.stp | 14 ++++++++++++++ testsuite/semko/fourteen.stp | 20 ++++++++++++++++++++ testsuite/semko/thirteen.stp | 20 ++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100755 testsuite/semko/fifteen.stp create mode 100755 testsuite/semko/fourteen.stp create mode 100755 testsuite/semko/thirteen.stp (limited to 'testsuite/semko') diff --git a/testsuite/semko/fifteen.stp b/testsuite/semko/fifteen.stp new file mode 100755 index 00000000..612271db --- /dev/null +++ b/testsuite/semko/fifteen.stp @@ -0,0 +1,14 @@ +#! stap -p2 + +global tangle + +probe begin +{ + foreach (state in tangle) + { + state = tangle[state]++ + } + printk("hello from systemtap") +} + + diff --git a/testsuite/semko/fourteen.stp b/testsuite/semko/fourteen.stp new file mode 100755 index 00000000..16bd784b --- /dev/null +++ b/testsuite/semko/fourteen.stp @@ -0,0 +1,20 @@ +#! stap -p2 + +global foo + +function bar() +{ + a = foo["hello"]++ + return 10 +} + +probe begin +{ + foreach (a in foo) + { + bar() + } + printk("hello from systemtap") +} + + diff --git a/testsuite/semko/thirteen.stp b/testsuite/semko/thirteen.stp new file mode 100755 index 00000000..88761ded --- /dev/null +++ b/testsuite/semko/thirteen.stp @@ -0,0 +1,20 @@ +#! stap -p2 + +global foo + +function bar() +{ + foo["hello"] = 10 + return 10 +} + +probe begin +{ + foreach (a in foo) + { + bar() + } + printk("hello from systemtap") +} + + -- cgit