2 * filter-visitor-ir-check-binary-comparator.c
4 * LTTng filter IR check binary comparator
6 * Copyright 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * SPDX-License-Identifier: LGPL-2.1-only
12 #include "filter-ast.hpp"
13 #include "filter-ir.hpp"
14 #include "filter-parser.hpp"
16 #include <common/compat/errno.hpp>
24 static int check_bin_comparator(struct ir_op
*node
)
29 fprintf(stderr
, "[error] %s: unknown op type\n", __func__
);
33 return check_bin_comparator(node
->u
.root
.child
);
37 return check_bin_comparator(node
->u
.unary
.child
);
42 if (node
->u
.binary
.left
->data_type
== IR_DATA_STRING
||
43 node
->u
.binary
.right
->data_type
== IR_DATA_STRING
) {
44 if (node
->u
.binary
.type
!= AST_OP_EQ
&& node
->u
.binary
.type
!= AST_OP_NE
) {
46 "[error] Only '==' and '!=' comparators are allowed for strings\n");
51 ret
= check_bin_comparator(node
->u
.binary
.left
);
54 return check_bin_comparator(node
->u
.binary
.right
);
60 ret
= check_bin_comparator(node
->u
.logical
.left
);
63 return check_bin_comparator(node
->u
.logical
.right
);
68 int filter_visitor_ir_check_binary_comparator(struct filter_parser_ctx
*ctx
)
70 return check_bin_comparator(ctx
->ir_root
);
This page took 0.031644 seconds and 4 git commands to generate.