From 9b5af2958a35174a67076c0f27cff0ed5950736d Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 11 Feb 2009 14:34:32 -0800 Subject: Add high-level support for @cast()ing This handles all of the parsing, traversal, and optimization. It doesn't actually resolve the cast yet though. * staptree.h (struct cast_op, visitor::visit_cast_op): New. * staptree.cxx (cast_op::print/visit, various visitor::visit_cast_op's): Incorporate cast_op into the basic tree operations. * parse.cxx (parser::parse_symbol): Parse @cast operator with an expression operand, type string, and optional module string. * translate.cxx (c_unparser::visit_cast_op): Error out if a @cast survives to translation. * elaborate.cxx (typeresolution_info::visit_cast_op): Error out if a @cast survives to type resolution. (symbol_fetcher::visit_cast_op): treat @casts as a symbol target (void_statement_reducer::visit_cast_op): unused @casts can be discarded, but the operand should still be evaluated. --- translate.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'translate.cxx') diff --git a/translate.cxx b/translate.cxx index 0d430ea3..da647722 100644 --- a/translate.cxx +++ b/translate.cxx @@ -150,6 +150,7 @@ struct c_unparser: public unparser, public visitor void visit_print_format (print_format* e); void visit_stat_op (stat_op* e); void visit_hist_op (hist_op* e); + void visit_cast_op (cast_op* e); }; // A shadow visitor, meant to generate temporary variable declarations @@ -3487,6 +3488,13 @@ c_unparser::visit_target_symbol (target_symbol* e) } +void +c_unparser::visit_cast_op (cast_op* e) +{ + throw semantic_error("cannot translate general cast expression", e->tok); +} + + void c_tmpcounter::load_map_indices(arrayindex *e) { -- cgit From 482fe2af17347b472232c5d7c4b26e53606e395e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 17 Feb 2009 19:19:48 -0800 Subject: Bump copyright years to 2009 --- translate.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'translate.cxx') diff --git a/translate.cxx b/translate.cxx index da647722..2d1c081a 100644 --- a/translate.cxx +++ b/translate.cxx @@ -1,5 +1,5 @@ // translation pass -// Copyright (C) 2005-2008 Red Hat Inc. +// Copyright (C) 2005-2009 Red Hat Inc. // Copyright (C) 2005-2008 Intel Corporation. // // This file is part of systemtap, and is free software. You can -- cgit