diff options
author | fche <fche> | 2006-01-24 17:58:02 +0000 |
---|---|---|
committer | fche <fche> | 2006-01-24 17:58:02 +0000 |
commit | cbfbbf6996cbe3b9fe57ac2014aa7262bb6890d6 (patch) | |
tree | 89b507411bd828b12142f0962be3eb4a33c3a45d /parse.cxx | |
parent | 46746514a6943520ff73b6f77d35477e2abb30ba (diff) | |
download | systemtap-steved-cbfbbf6996cbe3b9fe57ac2014aa7262bb6890d6.tar.gz systemtap-steved-cbfbbf6996cbe3b9fe57ac2014aa7262bb6890d6.tar.xz systemtap-steved-cbfbbf6996cbe3b9fe57ac2014aa7262bb6890d6.zip |
2006-01-24 Frank Ch. Eigler <fche@elastic.org>
PR 2060 etc.
* tapsets.cxx (visit_target_symbol): Tolerate failed resolution by
letting target_symbol instance pass through to optimizer and
type checker.
* elaborate.cxx (semantic_pass_optimize): New family of functions and
associated visitor classes.
(visit_for_loop): Tolerate absent init/incr clauses.
(semantic_pass): Invoke unless unoptimized (-u) option given.
* main.cxx, session.h: Add support for flag.
* staptree.cxx (visit_for_loop): Tolerate absent init/incr clauses.
(traversing_visitor::visit_arrayindex): Visit the index expressions.
(functioncall_traversing_visitor): New class.
(varuse_tracking_visitor): New class.
* staptree.h: Corresponding changes.
* parse.cxx (parse_for_loop): Represent absent init/incr expressions
with null statement pointer instead of optimized-out dummy numbers.
* stap.1.in: Document optimization.
* testsuite/{semko,transko}/*.stp: Added "-u" or other code to many
tests to check bad code without optimizer elision.
* testsuite/semok/optimize.stp: New test.
* elaborate.cxx (unresolved, invalid, mismatch): Standardize error
message wording.
* stapfuncs.5.in: Tweak print/printf docs.
* tapset/logging.stp: Remove redundant "print" auxiliary function,
since it's a translator built-in.
* testsuite/transok/five.stp: Extend test.
* translate.cxx (emit_symbol_data): Put symbol table into a separate
temporary header file, to make "-p3" output easier on the eyes.
* buildrun.cxx (compile_pass): Eliminate test-mode support throughout.
* main.cxx, session.h, translate.cxx: Ditto.
* main.cxx (main): For last-pass=2 runs, print post-optimization ASTs.
Diffstat (limited to 'parse.cxx')
-rw-r--r-- | parse.cxx | 35 |
1 files changed, 12 insertions, 23 deletions
@@ -1232,11 +1232,8 @@ parser::parse_for_loop () t = peek (); if (t && t->type == tok_operator && t->content == ";") { - literal_number* l = new literal_number(0); - expr_statement* es = new expr_statement; - es->value = l; - s->init = es; - es->value->tok = es->tok = next (); + s->init = 0; + next (); } else { @@ -1266,11 +1263,8 @@ parser::parse_for_loop () t = peek (); if (t && t->type == tok_operator && t->content == ")") { - literal_number* l = new literal_number(2); - expr_statement* es = new expr_statement; - es->value = l; - s->incr = es; - es->value->tok = es->tok = next (); + s->incr = 0; + next (); } else { @@ -1301,23 +1295,12 @@ parser::parse_while_loop () throw parse_error ("expected '('"); // dummy init and incr fields - literal_number* l = new literal_number(0); - expr_statement* es = new expr_statement; - es->value = l; - s->init = es; - es->value->tok = es->tok = t; - - l = new literal_number(2); - es = new expr_statement; - es->value = l; - s->incr = es; - es->value->tok = es->tok = t; - + s->init = 0; + s->incr = 0; // condition s->cond = parse_expression (); - t = next (); if (! (t->type == tok_operator && t->content == ")")) throw parse_error ("expected ')'"); @@ -1808,6 +1791,12 @@ parser::parse_unary () expression* parser::parse_crement () // as in "increment" / "decrement" { + // NB: Ideally, we'd parse only a symbol as an operand to the + // *crement operators, instead of a general expression value. We'd + // need more complex lookahead code to tell apart the postfix cases. + // So we just punt, and leave it to pass-3 to signal errors on + // cases like "4++". + const token* t = peek (); if (t && t->type == tok_operator && (t->content == "++" || t->content == "--")) |