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 "filter-ast.h"
20 #include "filter-parser.h"
21 #include "filter-ir.h"
24 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
45 if (node
->u
.binary
.type
!= AST_OP_EQ
46 && node
->u
.binary
.type
!= AST_OP_NE
) {
47 fprintf(stderr
, "[error] Only '==' and '!=' comparators are allowed for strings\n");
52 ret
= check_bin_comparator(node
->u
.binary
.left
);
55 return check_bin_comparator(node
->u
.binary
.right
);
61 ret
= check_bin_comparator(node
->u
.logical
.left
);
64 return check_bin_comparator(node
->u
.logical
.right
);
69 int filter_visitor_ir_check_binary_comparator(struct filter_parser_ctx
*ctx
)
71 return check_bin_comparator(ctx
->ir_root
);
This page took 0.031071 seconds and 5 git commands to generate.