From 54dfabe9e604ec06cdb5550f58420c60d0cbdbd9 Mon Sep 17 00:00:00 2001 From: fche Date: Tue, 26 Jul 2005 22:40:14 +0000 Subject: 2005-07-26 Frank Ch. Eigler Support %{ embedded-c %} * staptree.h (embeddedcode): New statement subtype. Stub support in visitors. * staptree.cxx: Ditto. * parse.cxx: Parse %{ / %}. Accept "_" as identifier leading char. (parse_probe): Simplify calling convention. * elaborate.h: Store embedded code. * elaborate.cxx: Pass it. * translate.cxx: Transcribe it. Return some dropped module init/exit code. * Makefile.am: Add buildok/buildko tests. * Makefile.in: Regenerated. * main.cxx: Return EXIT_SUCCESS/FAILURE even for weird rc. * testsuite/parseok/nine.stp: Test _identifiers. * testsuite/transko/*.stp: Tweak to force -p3 rather than -p2 errors. * testsuite/semok/transko.stp: ... and keep it that way in the future. * testsuite/parse*/*: Some new tests for %{ %}. * testsuite/build*/*: New tests for -p4. --- staptree.h | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'staptree.h') diff --git a/staptree.h b/staptree.h index 62bd8dfe..cfc09eb3 100644 --- a/staptree.h +++ b/staptree.h @@ -236,12 +236,12 @@ struct vardecl_builtin: public vardecl }; -struct block; +struct statement; struct functiondecl: public symboldecl { std::vector formal_args; std::vector locals; - block* body; + statement* body; functiondecl (); void print (std::ostream& o); void printsig (std::ostream& o); @@ -263,6 +263,14 @@ struct statement std::ostream& operator << (std::ostream& o, statement& k); +struct embeddedcode: public statement +{ + std::string code; + void print (std::ostream& o); + void visit (visitor* u); +}; + + struct block: public statement { std::vector statements; @@ -358,6 +366,7 @@ struct next_statement: public statement struct probe; struct probe_alias; +struct embeddedcode; struct stapfile { std::string name; @@ -365,10 +374,13 @@ struct stapfile std::vector aliases; std::vector functions; std::vector globals; + std::vector embeds; void print (std::ostream& o); }; + + struct probe_point { struct component // XXX: sort of a restricted functioncall @@ -398,13 +410,11 @@ struct probe virtual ~probe() {} }; -struct probe_alias - : public probe +struct probe_alias: public probe { probe_alias(std::vector const & aliases); std::vector alias_names; virtual void printsig (std::ostream &o); - virtual ~probe_alias() {} }; @@ -414,6 +424,7 @@ struct visitor { virtual ~visitor () {} virtual void visit_block (block *s) = 0; + virtual void visit_embeddedcode (embeddedcode *s) = 0; virtual void visit_null_statement (null_statement *s) = 0; virtual void visit_expr_statement (expr_statement *s) = 0; virtual void visit_if_statement (if_statement* s) = 0; @@ -449,6 +460,7 @@ struct visitor struct traversing_visitor: public visitor { void visit_block (block *s); + void visit_embeddedcode (embeddedcode *s); void visit_null_statement (null_statement *s); void visit_expr_statement (expr_statement *s); void visit_if_statement (if_statement* s); @@ -489,6 +501,7 @@ struct throwing_visitor: public visitor virtual void throwone (const token* t); void visit_block (block *s); + void visit_embeddedcode (embeddedcode *s); void visit_null_statement (null_statement *s); void visit_expr_statement (expr_statement *s); void visit_if_statement (if_statement* s); @@ -531,6 +544,7 @@ struct deep_copy_visitor: public visitor static block *deep_copy (block *s); void visit_block (block *s); + void visit_embeddedcode (embeddedcode *s); void visit_null_statement (null_statement *s); void visit_expr_statement (expr_statement *s); void visit_if_statement (if_statement* s); -- cgit