summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2010-02-25 16:20:50 -0800
committerJosh Stone <jistone@redhat.com>2010-02-25 16:20:50 -0800
commitb7aedf26f105793793c66c39c85abe76e1510e66 (patch)
treee38acbbc143220e87a2226b55832264d970fc144 /elaborate.cxx
parent70208613b8f9f2584aee89197705f3fddae6a0e4 (diff)
downloadsystemtap-steved-b7aedf26f105793793c66c39c85abe76e1510e66.tar.gz
systemtap-steved-b7aedf26f105793793c66c39c85abe76e1510e66.tar.xz
systemtap-steved-b7aedf26f105793793c66c39c85abe76e1510e66.zip
Expand @defined to support more cases
* tapsets.cxx (var_expanding_visitor::visit_defined_op): If no error was raised or replacement made on a target_symbol, then its @defined state is still indeterminate. Some later pass (like @cast) might handle it. * elaborate.cxx (const_folder::visit_defined_op): Squash any escapees. * testsuite/semok/thirtysix.stp: Add more variants.
Diffstat (limited to 'elaborate.cxx')
-rw-r--r--elaborate.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/elaborate.cxx b/elaborate.cxx
index 5f3cc8ae..12dbce3a 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -3010,6 +3010,7 @@ struct const_folder: public update_visitor
void visit_comparison (comparison* e);
void visit_concatenation (concatenation* e);
void visit_ternary_expression (ternary_expression* e);
+ void visit_defined_op (defined_op* e);
};
void
@@ -3471,6 +3472,20 @@ const_folder::visit_ternary_expression (ternary_expression* e)
}
}
+void
+const_folder::visit_defined_op (defined_op* e)
+{
+ // If a @defined makes it this far, then it is, de facto, undefined.
+
+ if (session.verbose>2)
+ clog << "Collapsing untouched @defined check " << *e->tok << endl;
+ relaxed_p = false;
+
+ literal_number* n = new literal_number (0);
+ n->tok = e->tok;
+ n->visit (this);
+}
+
static void semantic_pass_const_fold (systemtap_session& s, bool& relaxed_p)
{
// Let's simplify statements with constant values.