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
19 #include <common/compat/errno.h>
21 #include "filter-ast.h"
22 #include "filter-parser.h"
23 #include "filter-ir.h"
26 int check_bin_comparator(struct ir_op
*node
)
31 fprintf(stderr
, "[error] %s: unknown op type\n", __func__
);
35 return check_bin_comparator(node
->u
.root
.child
);
39 return check_bin_comparator(node
->u
.unary
.child
);
44 if (node
->u
.binary
.left
->data_type
== IR_DATA_STRING
45 || node
->u
.binary
.right
->data_type
47 if (node
->u
.binary
.type
!= AST_OP_EQ
48 && node
->u
.binary
.type
!= AST_OP_NE
) {
49 fprintf(stderr
, "[error] Only '==' and '!=' comparators are allowed for strings\n");
54 ret
= check_bin_comparator(node
->u
.binary
.left
);
57 return check_bin_comparator(node
->u
.binary
.right
);
63 ret
= check_bin_comparator(node
->u
.logical
.left
);
66 return check_bin_comparator(node
->u
.logical
.right
);
71 int filter_visitor_ir_check_binary_comparator(struct filter_parser_ctx
*ctx
)
73 return check_bin_comparator(ctx
->ir_root
);
This page took 0.04043 seconds and 4 git commands to generate.