summaryrefslogtreecommitdiffstats
path: root/elaborate.cxx
diff options
context:
space:
mode:
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.