summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-05-08 19:30:42 -0700
committerJosh Stone <jistone@redhat.com>2009-05-08 19:34:58 -0700
commit946e1a48eb5b92dcf17a064b62157124da661869 (patch)
tree3a57fe74b48b32f668ab456618883ac0b6f19cbf /tapsets.cxx
parent56212da92dae36e5870ac6149c89d967fcab10f9 (diff)
downloadsystemtap-steved-946e1a48eb5b92dcf17a064b62157124da661869.tar.gz
systemtap-steved-946e1a48eb5b92dcf17a064b62157124da661869.tar.xz
systemtap-steved-946e1a48eb5b92dcf17a064b62157124da661869.zip
Allow @cast failures to get optimized away
We have the saved_conversion_error field, but I wasn't using it. Now @cast errors are saved in that field, so they're only seen if the optimizer doesn't remove the @cast.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx30
1 files changed, 13 insertions, 17 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 1e0d9e6b..ac43a222 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -4775,13 +4775,13 @@ dwarf_var_expanding_visitor::visit_cast_op (cast_op *e)
struct dwarf_cast_query : public base_query
{
- const cast_op& e;
+ cast_op& e;
const bool lvalue;
exp_type& pe_type;
string& code;
- dwarf_cast_query(dwflpp& dw, const string& module, const cast_op& e,
+ dwarf_cast_query(dwflpp& dw, const string& module, cast_op& e,
bool lvalue, exp_type& pe_type, string& code):
base_query(dw, module), e(e), lvalue(lvalue),
pe_type(pe_type), code(code) {}
@@ -4819,11 +4819,15 @@ dwarf_cast_query::handle_query_cu(Dwarf_Die * cudie)
code = dw.literal_stmt_for_pointer (type_die, &e,
lvalue, pe_type);
}
- catch (const semantic_error& e)
+ catch (const semantic_error& er)
{
- // XXX might be better to save the error
- // and try again in another CU
- sess.print_error (e);
+ // XXX might be better to try again in another CU
+ // NB: we can have multiple errors, since a @cast
+ // may be expanded in several different contexts:
+ // function ("*") { @cast(...) }
+ semantic_error* new_er = new semantic_error(er);
+ new_er->chain = e.saved_conversion_error;
+ e.saved_conversion_error = new_er;
}
return DWARF_CB_ABORT;
}
@@ -4972,17 +4976,9 @@ void dwarf_cast_expanding_visitor::visit_cast_op (cast_op* e)
if (code.empty())
{
- // We generate an error message, and pass the unresolved
- // cast_op to the next pass. We hope that this value ends
- // up not being referenced after all, so it can be optimized out
- // quietly.
- string msg = "type definition '" + e->type + "' not found";
- semantic_error* er = new semantic_error (msg, e->tok);
- // NB: we can have multiple errors, since a @cast
- // may be expanded in several different contexts:
- // function ("*") { @cast(...) }
- er->chain = e->saved_conversion_error;
- e->saved_conversion_error = er;
+ // We pass the unresolved cast_op to the next pass, and hope
+ // that this value ends up not being referenced after all, so
+ // it can be optimized out quietly.
provide (e);
return;
}