author | Mario de Sousa <msousa@fe.up.pt> |
Sun, 10 Jun 2012 21:47:15 +0100 | |
changeset 576 | 8368ec909825 |
parent 560 | 13b5b7faa3d7 |
child 581 | 1e158dc9f9c1 |
permissions | -rw-r--r-- |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
1 |
/* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
2 |
* matiec - a compiler for the programming languages defined in IEC 61131-3 |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
3 |
* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
4 |
* Copyright (C) 2009-2012 Mario de Sousa (msousa@fe.up.pt) |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
5 |
* Copyright (C) 2012 Manuele Conti (conti.ma@alice.it) |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
6 |
* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
7 |
* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
8 |
* This program is free software: you can redistribute it and/or modify |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
9 |
* it under the terms of the GNU General Public License as published by |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
10 |
* the Free Software Foundation, either version 3 of the License, or |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
11 |
* (at your option) any later version. |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
12 |
* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
13 |
* This program is distributed in the hope that it will be useful, |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
16 |
* GNU General Public License for more details. |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
17 |
* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
20 |
* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
21 |
* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
22 |
* This code is made available on the understanding that it will not be |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
23 |
* used in safety-critical situations without a full and competent review. |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
24 |
*/ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
25 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
26 |
/* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
27 |
* An IEC 61131-3 compiler. |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
28 |
* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
29 |
* Based on the |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
30 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
31 |
* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
32 |
*/ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
33 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
34 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
35 |
/* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
36 |
* TODO: |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
37 |
* - Check subscript values fall within allowed range. |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
38 |
* For the checking of subscript values to work correctly, we would need to have constant folding working too: |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
39 |
* array_var[8 + 99] can not be checked without constant folding. |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
40 |
* However, even without constant folding range check may be usefull, |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
41 |
* and later changing it to use the values coming out of constant folding should not be very difficult. |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
42 |
* |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
43 |
*/ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
44 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
45 |
|
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
46 |
#include "array_range_check.hh" |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
47 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
48 |
#define FIRST_(symbol1, symbol2) (((symbol1)->first_order < (symbol2)->first_order) ? (symbol1) : (symbol2)) |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
49 |
#define LAST_(symbol1, symbol2) (((symbol1)->last_order > (symbol2)->last_order) ? (symbol1) : (symbol2)) |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
50 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
51 |
#define STAGE3_ERROR(error_level, symbol1, symbol2, ...) { \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
52 |
if (current_display_error_level >= error_level) { \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
53 |
fprintf(stderr, "%s:%d-%d..%d-%d: error: ", \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
54 |
FIRST_(symbol1,symbol2)->first_file, FIRST_(symbol1,symbol2)->first_line, FIRST_(symbol1,symbol2)->first_column,\ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
55 |
LAST_(symbol1,symbol2) ->last_line, LAST_(symbol1,symbol2) ->last_column);\ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
56 |
fprintf(stderr, __VA_ARGS__); \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
57 |
fprintf(stderr, "\n"); \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
58 |
error_count++; \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
59 |
} \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
60 |
} |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
61 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
62 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
63 |
#define STAGE3_WARNING(symbol1, symbol2, ...) { \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
64 |
fprintf(stderr, "%s:%d-%d..%d-%d: warning: ", \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
65 |
FIRST_(symbol1,symbol2)->first_file, FIRST_(symbol1,symbol2)->first_line, FIRST_(symbol1,symbol2)->first_column,\ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
66 |
LAST_(symbol1,symbol2) ->last_line, LAST_(symbol1,symbol2) ->last_column);\ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
67 |
fprintf(stderr, __VA_ARGS__); \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
68 |
fprintf(stderr, "\n"); \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
69 |
warning_found = true; \ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
70 |
} |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
71 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
72 |
|
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
73 |
array_range_check_c::array_range_check_c(symbol_c *ignore) { |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
74 |
error_count = 0; |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
75 |
current_display_error_level = 0; |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
76 |
} |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
77 |
|
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
78 |
array_range_check_c::~array_range_check_c(void) { |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
79 |
} |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
80 |
|
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
81 |
int array_range_check_c::get_error_count() { |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
82 |
return error_count; |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
83 |
} |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
84 |
|
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
85 |
void array_range_check_c::check_dimension_count(array_variable_c *symbol) { |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
86 |
int dimension_count; |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
87 |
symbol_c *var_decl; |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
88 |
|
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
89 |
var_decl = search_varfb_instance_type->get_basetype_decl(symbol->subscripted_variable); |
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
90 |
array_dimension_iterator_c array_dimension_iterator(var_decl); |
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
91 |
for (dimension_count = 0; NULL != array_dimension_iterator.next(); dimension_count++); |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
92 |
if (dimension_count != ((list_c *)symbol->subscript_list)->n) |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
93 |
STAGE3_ERROR(0, symbol, symbol, "Number of dimensions does not match, Array have %d dimension(s)", dimension_count); |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
94 |
} |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
95 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
96 |
/*********************/ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
97 |
/* B 1.4 - Variables */ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
98 |
/*********************/ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
99 |
/*************************************/ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
100 |
/* B 1.4.2 - Multi-element variables */ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
101 |
/*************************************/ |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
102 |
void *array_range_check_c::visit(array_variable_c *symbol) { |
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
103 |
check_dimension_count(symbol); |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
104 |
return NULL; |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
105 |
} |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
106 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
107 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
108 |
/**************************************/ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
109 |
/* B 1.5 - Program organisation units */ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
110 |
/**************************************/ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
111 |
/***********************/ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
112 |
/* B 1.5.1 - Functions */ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
113 |
/***********************/ |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
114 |
void *array_range_check_c::visit(function_declaration_c *symbol) { |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
115 |
search_varfb_instance_type = new search_varfb_instance_type_c(symbol); |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
116 |
// search_var_instance_decl = new search_var_instance_decl_c(symbol); |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
117 |
symbol->function_body->accept(*this); |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
118 |
delete search_varfb_instance_type; |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
119 |
// delete search_var_instance_decl; |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
120 |
search_varfb_instance_type = NULL; |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
121 |
// search_var_instance_decl = NULL; |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
122 |
return NULL; |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
123 |
} |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
124 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
125 |
/*****************************/ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
126 |
/* B 1.5.2 - Function blocks */ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
127 |
/*****************************/ |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
128 |
void *array_range_check_c::visit(function_block_declaration_c *symbol) { |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
129 |
search_varfb_instance_type = new search_varfb_instance_type_c(symbol); |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
130 |
// search_var_instance_decl = new search_var_instance_decl_c(symbol); |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
131 |
symbol->fblock_body->accept(*this); |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
132 |
delete search_varfb_instance_type; |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
133 |
// delete search_var_instance_decl; |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
134 |
search_varfb_instance_type = NULL; |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
135 |
// search_var_instance_decl = NULL; |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
136 |
return NULL; |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
137 |
} |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
138 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
139 |
/**********************/ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
140 |
/* B 1.5.3 - Programs */ |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
141 |
/**********************/ |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
142 |
void *array_range_check_c::visit(program_declaration_c *symbol) { |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
143 |
search_varfb_instance_type = new search_varfb_instance_type_c(symbol); |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
144 |
// search_var_instance_decl = new search_var_instance_decl_c(symbol); |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
145 |
symbol->function_block_body->accept(*this); |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
146 |
delete search_varfb_instance_type; |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
147 |
// delete search_var_instance_decl; |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
148 |
search_varfb_instance_type = NULL; |
560
13b5b7faa3d7
Renamed class, remove unused code, delete allocated objects.
mjsousa <msousa@fe.up.pt>
parents:
559
diff
changeset
|
149 |
// search_var_instance_decl = NULL; |
559
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
150 |
return NULL; |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
151 |
} |
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
152 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
153 |
|
a3b8925e640c
Start sematinc range check class.
Manuele Conti <conti.ma@alice.it>
parents:
diff
changeset
|
154 |