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
18 #include <common/compat/errno.h>
20 #include "filter-ast.h"
21 #include "filter-parser.h"
22 #include "filter-ir.h"
25 int check_bin_comparator(struct ir_op
*node
)
30 fprintf(stderr
, "[error] %s: unknown op type\n", __func__
);
34 return check_bin_comparator(node
->u
.root
.child
);
38 return check_bin_comparator(node
->u
.unary
.child
);
43 if (node
->u
.binary
.left
->data_type
== IR_DATA_STRING
44 || node
->u
.binary
.right
->data_type
46 if (node
->u
.binary
.type
!= AST_OP_EQ
47 && node
->u
.binary
.type
!= AST_OP_NE
) {
48 fprintf(stderr
, "[error] Only '==' and '!=' comparators are allowed for strings\n");
53 ret
= check_bin_comparator(node
->u
.binary
.left
);
56 return check_bin_comparator(node
->u
.binary
.right
);
62 ret
= check_bin_comparator(node
->u
.logical
.left
);
65 return check_bin_comparator(node
->u
.logical
.right
);
70 int filter_visitor_ir_check_binary_comparator(struct filter_parser_ctx
*ctx
)
72 return check_bin_comparator(ctx
->ir_root
);
This page took 0.032196 seconds and 4 git commands to generate.