File: | build/gcc/cp/search.cc |
Warning: | line 1167, column 5 Value stored to 'type' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* Breadth-first and depth-first routines for |
2 | searching multiple-inheritance lattice for GNU C++. |
3 | Copyright (C) 1987-2023 Free Software Foundation, Inc. |
4 | Contributed by Michael Tiemann (tiemann@cygnus.com) |
5 | |
6 | This file is part of GCC. |
7 | |
8 | GCC is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 3, or (at your option) |
11 | any later version. |
12 | |
13 | GCC is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with GCC; see the file COPYING3. If not see |
20 | <http://www.gnu.org/licenses/>. */ |
21 | |
22 | /* High-level class interface. */ |
23 | |
24 | #include "config.h" |
25 | #include "system.h" |
26 | #include "coretypes.h" |
27 | #include "cp-tree.h" |
28 | #include "intl.h" |
29 | #include "toplev.h" |
30 | #include "spellcheck-tree.h" |
31 | #include "stringpool.h" |
32 | #include "attribs.h" |
33 | #include "tree-inline.h" |
34 | |
35 | static int is_subobject_of_p (tree, tree); |
36 | static tree dfs_lookup_base (tree, void *); |
37 | static tree dfs_dcast_hint_pre (tree, void *); |
38 | static tree dfs_dcast_hint_post (tree, void *); |
39 | static tree dfs_debug_mark (tree, void *); |
40 | static int check_hidden_convs (tree, int, int, tree, tree, tree); |
41 | static tree split_conversions (tree, tree, tree, tree); |
42 | static int lookup_conversions_r (tree, int, int, tree, tree, tree *); |
43 | static int look_for_overrides_r (tree, tree); |
44 | static tree lookup_field_r (tree, void *); |
45 | static tree dfs_accessible_post (tree, void *); |
46 | static tree dfs_walk_once_accessible (tree, bool, |
47 | tree (*pre_fn) (tree, void *), |
48 | tree (*post_fn) (tree, void *), |
49 | void *data); |
50 | static tree dfs_access_in_type (tree, void *); |
51 | static access_kind access_in_type (tree, tree); |
52 | static tree dfs_get_pure_virtuals (tree, void *); |
53 | |
54 | |
55 | /* Data for lookup_base and its workers. */ |
56 | |
57 | struct lookup_base_data_s |
58 | { |
59 | tree t; /* type being searched. */ |
60 | tree base; /* The base type we're looking for. */ |
61 | tree binfo; /* Found binfo. */ |
62 | bool via_virtual; /* Found via a virtual path. */ |
63 | bool ambiguous; /* Found multiply ambiguous */ |
64 | bool repeated_base; /* Whether there are repeated bases in the |
65 | hierarchy. */ |
66 | bool want_any; /* Whether we want any matching binfo. */ |
67 | }; |
68 | |
69 | /* Worker function for lookup_base. See if we've found the desired |
70 | base and update DATA_ (a pointer to LOOKUP_BASE_DATA_S). */ |
71 | |
72 | static tree |
73 | dfs_lookup_base (tree binfo, void *data_) |
74 | { |
75 | struct lookup_base_data_s *data = (struct lookup_base_data_s *) data_; |
76 | |
77 | if (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), data->base)((((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 77, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 77, __FUNCTION__))->typed.type)) == (data->base))) |
78 | { |
79 | if (!data->binfo) |
80 | { |
81 | data->binfo = binfo; |
82 | data->via_virtual |
83 | = binfo_via_virtual (data->binfo, data->t) != NULL_TREE(tree) __null; |
84 | |
85 | if (!data->repeated_base) |
86 | /* If there are no repeated bases, we can stop now. */ |
87 | return binfo; |
88 | |
89 | if (data->want_any && !data->via_virtual) |
90 | /* If this is a non-virtual base, then we can't do |
91 | better. */ |
92 | return binfo; |
93 | |
94 | return dfs_skip_bases((tree)1); |
95 | } |
96 | else |
97 | { |
98 | gcc_assert (binfo != data->binfo)((void)(!(binfo != data->binfo) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 98, __FUNCTION__), 0 : 0)); |
99 | |
100 | /* We've found more than one matching binfo. */ |
101 | if (!data->want_any) |
102 | { |
103 | /* This is immediately ambiguous. */ |
104 | data->binfo = NULL_TREE(tree) __null; |
105 | data->ambiguous = true; |
106 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
107 | } |
108 | |
109 | /* Prefer one via a non-virtual path. */ |
110 | if (!binfo_via_virtual (binfo, data->t)) |
111 | { |
112 | data->binfo = binfo; |
113 | data->via_virtual = false; |
114 | return binfo; |
115 | } |
116 | |
117 | /* There must be repeated bases, otherwise we'd have stopped |
118 | on the first base we found. */ |
119 | return dfs_skip_bases((tree)1); |
120 | } |
121 | } |
122 | |
123 | return NULL_TREE(tree) __null; |
124 | } |
125 | |
126 | /* This deals with bug PR17314. |
127 | |
128 | DECL is a declaration and BINFO represents a class that has attempted (but |
129 | failed) to access DECL. |
130 | |
131 | Examine the parent binfos of BINFO and determine whether any of them had |
132 | private access to DECL. If they did, return the parent binfo. This helps |
133 | in figuring out the correct error message to show (if the parents had |
134 | access, it's their fault for not giving sufficient access to BINFO). |
135 | |
136 | If no parents had access, return NULL_TREE. */ |
137 | |
138 | tree |
139 | get_parent_with_private_access (tree decl, tree binfo) |
140 | { |
141 | /* Only BINFOs should come through here. */ |
142 | gcc_assert (TREE_CODE (binfo) == TREE_BINFO)((void)(!(((enum tree_code) (binfo)->base.code) == TREE_BINFO ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 142, __FUNCTION__), 0 : 0)); |
143 | |
144 | tree base_binfo = NULL_TREE(tree) __null; |
145 | |
146 | /* Iterate through immediate parent classes. */ |
147 | for (int i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo)((&(tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 147, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)-> iterate ((i), &(base_binfo))); i++) |
148 | { |
149 | /* This parent had private access. Therefore that's why BINFO can't |
150 | access DECL. */ |
151 | if (access_in_type (BINFO_TYPE (base_binfo)((contains_struct_check (((tree_check ((base_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 151, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 151, __FUNCTION__))->typed.type), decl) == ak_private) |
152 | return base_binfo; |
153 | } |
154 | |
155 | /* None of the parents had access. Note: it's impossible for one of the |
156 | parents to have had public or protected access to DECL, since then |
157 | BINFO would have been able to access DECL too. */ |
158 | return NULL_TREE(tree) __null; |
159 | } |
160 | |
161 | /* Returns true if type BASE is accessible in T. (BASE is known to be |
162 | a (possibly non-proper) base class of T.) If CONSIDER_LOCAL_P is |
163 | true, consider any special access of the current scope, or access |
164 | bestowed by friendship. */ |
165 | |
166 | bool |
167 | accessible_base_p (tree t, tree base, bool consider_local_p) |
168 | { |
169 | tree decl; |
170 | |
171 | /* [class.access.base] |
172 | |
173 | A base class is said to be accessible if an invented public |
174 | member of the base class is accessible. |
175 | |
176 | If BASE is a non-proper base, this condition is trivially |
177 | true. */ |
178 | if (same_type_p (t, base)comptypes ((t), (base), 0)) |
179 | return true; |
180 | /* Rather than inventing a public member, we use the implicit |
181 | public typedef created in the scope of every class. */ |
182 | decl = TYPE_FIELDS (base)((tree_check3 ((base), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 182, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); |
183 | while (!DECL_SELF_REFERENCE_P (decl)(((enum tree_code) (decl)->base.code) == TYPE_DECL && ((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 183, __FUNCTION__))->decl_common.lang_flag_4))) |
184 | decl = DECL_CHAIN (decl)(((contains_struct_check (((contains_struct_check ((decl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 184, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 184, __FUNCTION__))->common.chain)); |
185 | while (ANON_AGGR_TYPE_P (t)((((((enum tree_code) (t)->base.code)) == RECORD_TYPE || ( ((enum tree_code) (t)->base.code)) == UNION_TYPE) && ((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 185, __FUNCTION__))->type_common.lang_flag_5)) && (((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 185, __FUNCTION__))->type_with_lang_specific.lang_specific ))->anon_aggr)) |
186 | t = TYPE_CONTEXT (t)((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 186, __FUNCTION__))->type_common.context); |
187 | return accessible_p (t, decl, consider_local_p); |
188 | } |
189 | |
190 | /* Lookup BASE in the hierarchy dominated by T. Do access checking as |
191 | ACCESS specifies. Return the binfo we discover. If KIND_PTR is |
192 | non-NULL, fill with information about what kind of base we |
193 | discovered. |
194 | |
195 | If the base is inaccessible, or ambiguous, then error_mark_node is |
196 | returned. If the tf_error bit of COMPLAIN is not set, no error |
197 | is issued. */ |
198 | |
199 | tree |
200 | lookup_base (tree t, tree base, base_access access, |
201 | base_kind *kind_ptr, tsubst_flags_t complain) |
202 | { |
203 | tree binfo; |
204 | tree t_binfo; |
205 | base_kind bk; |
206 | |
207 | /* "Nothing" is definitely not derived from Base. */ |
208 | if (t == NULL_TREE(tree) __null) |
209 | { |
210 | if (kind_ptr) |
211 | *kind_ptr = bk_not_base; |
212 | return NULL_TREE(tree) __null; |
213 | } |
214 | |
215 | if (t == error_mark_nodeglobal_trees[TI_ERROR_MARK] || base == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
216 | { |
217 | if (kind_ptr) |
218 | *kind_ptr = bk_not_base; |
219 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
220 | } |
221 | gcc_assert (TYPE_P (base))((void)(!((tree_code_type_tmpl <0>::tree_code_type[(int ) (((enum tree_code) (base)->base.code))] == tcc_type)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 221, __FUNCTION__), 0 : 0)); |
222 | |
223 | if (!TYPE_P (t)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (t)->base.code))] == tcc_type)) |
224 | { |
225 | t_binfo = t; |
226 | t = BINFO_TYPE (t)((contains_struct_check (((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 226, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 226, __FUNCTION__))->typed.type); |
227 | } |
228 | else |
229 | { |
230 | t = complete_type (TYPE_MAIN_VARIANT (t)((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 230, __FUNCTION__))->type_common.main_variant)); |
231 | if (dependent_type_p (t)) |
232 | if (tree open = currently_open_class (t)) |
233 | t = open; |
234 | t_binfo = TYPE_BINFO (t)((tree_check3 ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 234, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval); |
235 | } |
236 | |
237 | base = TYPE_MAIN_VARIANT (base)((tree_class_check ((base), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 237, __FUNCTION__))->type_common.main_variant); |
238 | |
239 | /* If BASE is incomplete, it can't be a base of T--and instantiating it |
240 | might cause an error. */ |
241 | if (t_binfo && CLASS_TYPE_P (base)(((((enum tree_code) (base)->base.code)) == RECORD_TYPE || (((enum tree_code) (base)->base.code)) == UNION_TYPE) && ((tree_class_check ((base), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 241, __FUNCTION__))->type_common.lang_flag_5)) && COMPLETE_OR_OPEN_TYPE_P (base)((((tree_class_check ((base), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 241, __FUNCTION__))->type_common.size) != (tree) __null) || ((((((enum tree_code) (base)->base.code)) == RECORD_TYPE || (((enum tree_code) (base)->base.code)) == UNION_TYPE) && ((tree_class_check ((base), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 241, __FUNCTION__))->type_common.lang_flag_5)) && ((((tree_class_check ((base), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 241, __FUNCTION__))->type_with_lang_specific.lang_specific ))->being_defined)))) |
242 | { |
243 | struct lookup_base_data_s data; |
244 | |
245 | data.t = t; |
246 | data.base = base; |
247 | data.binfo = NULL_TREE(tree) __null; |
248 | data.ambiguous = data.via_virtual = false; |
249 | data.repeated_base = CLASSTYPE_REPEATED_BASE_P (t)((((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 249, __FUNCTION__))->type_with_lang_specific.lang_specific ))->repeated_base); |
250 | data.want_any = access == ba_any; |
251 | |
252 | dfs_walk_once (t_binfo, dfs_lookup_base, NULL__null, &data); |
253 | binfo = data.binfo; |
254 | |
255 | if (!binfo) |
256 | bk = data.ambiguous ? bk_ambig : bk_not_base; |
257 | else if (binfo == t_binfo) |
258 | bk = bk_same_type; |
259 | else if (data.via_virtual) |
260 | bk = bk_via_virtual; |
261 | else |
262 | bk = bk_proper_base; |
263 | } |
264 | else |
265 | { |
266 | binfo = NULL_TREE(tree) __null; |
267 | bk = bk_not_base; |
268 | } |
269 | |
270 | /* Check that the base is unambiguous and accessible. */ |
271 | if (access != ba_any) |
272 | switch (bk) |
273 | { |
274 | case bk_not_base: |
275 | break; |
276 | |
277 | case bk_ambig: |
278 | if (complain & tf_error) |
279 | error ("%qT is an ambiguous base of %qT", base, t); |
280 | binfo = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
281 | break; |
282 | |
283 | default: |
284 | if ((access & ba_check_bit) |
285 | /* If BASE is incomplete, then BASE and TYPE are probably |
286 | the same, in which case BASE is accessible. If they |
287 | are not the same, then TYPE is invalid. In that case, |
288 | there's no need to issue another error here, and |
289 | there's no implicit typedef to use in the code that |
290 | follows, so we skip the check. */ |
291 | && COMPLETE_TYPE_P (base)(((tree_class_check ((base), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 291, __FUNCTION__))->type_common.size) != (tree) __null) |
292 | && !accessible_base_p (t, base, !(access & ba_ignore_scope))) |
293 | { |
294 | if (complain & tf_error) |
295 | error ("%qT is an inaccessible base of %qT", base, t); |
296 | binfo = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
297 | bk = bk_inaccessible; |
298 | } |
299 | break; |
300 | } |
301 | |
302 | if (kind_ptr) |
303 | *kind_ptr = bk; |
304 | |
305 | return binfo; |
306 | } |
307 | |
308 | /* Data for dcast_base_hint walker. */ |
309 | |
310 | struct dcast_data_s |
311 | { |
312 | tree subtype; /* The base type we're looking for. */ |
313 | int virt_depth; /* Number of virtual bases encountered from most |
314 | derived. */ |
315 | tree offset; /* Best hint offset discovered so far. */ |
316 | bool repeated_base; /* Whether there are repeated bases in the |
317 | hierarchy. */ |
318 | }; |
319 | |
320 | /* Worker for dcast_base_hint. Search for the base type being cast |
321 | from. */ |
322 | |
323 | static tree |
324 | dfs_dcast_hint_pre (tree binfo, void *data_) |
325 | { |
326 | struct dcast_data_s *data = (struct dcast_data_s *) data_; |
327 | |
328 | if (BINFO_VIRTUAL_P (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 328, __FUNCTION__, (TREE_BINFO)))->base.static_flag)) |
329 | data->virt_depth++; |
330 | |
331 | if (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), data->subtype)((((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 331, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 331, __FUNCTION__))->typed.type)) == (data->subtype))) |
332 | { |
333 | if (data->virt_depth) |
334 | { |
335 | data->offset = ssize_int (-1)size_int_kind (-1, stk_ssizetype); |
336 | return data->offset; |
337 | } |
338 | if (data->offset) |
339 | data->offset = ssize_int (-3)size_int_kind (-3, stk_ssizetype); |
340 | else |
341 | data->offset = BINFO_OFFSET (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 341, __FUNCTION__, (TREE_BINFO)))->binfo.offset); |
342 | |
343 | return data->repeated_base ? dfs_skip_bases((tree)1) : data->offset; |
344 | } |
345 | |
346 | return NULL_TREE(tree) __null; |
347 | } |
348 | |
349 | /* Worker for dcast_base_hint. Track the virtual depth. */ |
350 | |
351 | static tree |
352 | dfs_dcast_hint_post (tree binfo, void *data_) |
353 | { |
354 | struct dcast_data_s *data = (struct dcast_data_s *) data_; |
355 | |
356 | if (BINFO_VIRTUAL_P (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 356, __FUNCTION__, (TREE_BINFO)))->base.static_flag)) |
357 | data->virt_depth--; |
358 | |
359 | return NULL_TREE(tree) __null; |
360 | } |
361 | |
362 | /* The dynamic cast runtime needs a hint about how the static SUBTYPE type |
363 | started from is related to the required TARGET type, in order to optimize |
364 | the inheritance graph search. This information is independent of the |
365 | current context, and ignores private paths, hence get_base_distance is |
366 | inappropriate. Return a TREE specifying the base offset, BOFF. |
367 | BOFF >= 0, there is only one public non-virtual SUBTYPE base at offset BOFF, |
368 | and there are no public virtual SUBTYPE bases. |
369 | BOFF == -1, SUBTYPE occurs as multiple public virtual or non-virtual bases. |
370 | BOFF == -2, SUBTYPE is not a public base. |
371 | BOFF == -3, SUBTYPE occurs as multiple public non-virtual bases. */ |
372 | |
373 | tree |
374 | dcast_base_hint (tree subtype, tree target) |
375 | { |
376 | struct dcast_data_s data; |
377 | |
378 | data.subtype = subtype; |
379 | data.virt_depth = 0; |
380 | data.offset = NULL_TREE(tree) __null; |
381 | data.repeated_base = CLASSTYPE_REPEATED_BASE_P (target)((((tree_class_check ((target), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 381, __FUNCTION__))->type_with_lang_specific.lang_specific ))->repeated_base); |
382 | |
383 | dfs_walk_once_accessible (TYPE_BINFO (target)((tree_check3 ((target), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 383, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval), /*friends=*/false, |
384 | dfs_dcast_hint_pre, dfs_dcast_hint_post, &data); |
385 | return data.offset ? data.offset : ssize_int (-2)size_int_kind (-2, stk_ssizetype); |
386 | } |
387 | |
388 | /* Search for a member with name NAME in a multiple inheritance |
389 | lattice specified by TYPE. If it does not exist, return NULL_TREE. |
390 | If the member is ambiguously referenced, return `error_mark_node'. |
391 | Otherwise, return a DECL with the indicated name. If WANT_TYPE is |
392 | true, type declarations are preferred. */ |
393 | |
394 | /* Return the FUNCTION_DECL, RECORD_TYPE, UNION_TYPE, or |
395 | NAMESPACE_DECL corresponding to the innermost non-block scope. */ |
396 | |
397 | tree |
398 | current_scope (void) |
399 | { |
400 | /* There are a number of cases we need to be aware of here: |
401 | current_class_type current_function_decl |
402 | global NULL NULL |
403 | fn-local NULL SET |
404 | class-local SET NULL |
405 | class->fn SET SET |
406 | fn->class SET SET |
407 | |
408 | Those last two make life interesting. If we're in a function which is |
409 | itself inside a class, we need decls to go into the fn's decls (our |
410 | second case below). But if we're in a class and the class itself is |
411 | inside a function, we need decls to go into the decls for the class. To |
412 | achieve this last goal, we must see if, when both current_class_ptr and |
413 | current_function_decl are set, the class was declared inside that |
414 | function. If so, we know to put the decls into the class's scope. */ |
415 | if (current_function_decl && current_class_typescope_chain->class_type |
416 | && ((DECL_FUNCTION_MEMBER_P (current_function_decl)((((enum tree_code) (((contains_struct_check ((current_function_decl ), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 416, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE ) || (__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast< union tree_node *> ((((tree_check ((current_function_decl) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 416, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 416, __FUNCTION__))->decl_common.lang_specific); if (!(( (enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL || (((enum tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast <union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 416, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 416, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 416, __FUNCTION__); <->u.fn; })->static_function )) |
417 | && same_type_p (DECL_CONTEXT (current_function_decl),comptypes ((((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 417, __FUNCTION__))->decl_minimal.context)), (scope_chain ->class_type), 0) |
418 | current_class_type)comptypes ((((contains_struct_check ((current_function_decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 417, __FUNCTION__))->decl_minimal.context)), (scope_chain ->class_type), 0)) |
419 | || (DECL_FRIEND_CONTEXT (current_function_decl)(((((enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL || (((enum tree_code) (current_function_decl)-> base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 419, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 419, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) && !((contains_struct_check ((current_function_decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 419, __FUNCTION__))->decl_common.virtual_flag) && !((tree_check (((((enum tree_code) (current_function_decl)-> base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)( const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 419, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl )), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 419, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor )) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast< union tree_node *> ((((tree_check ((current_function_decl) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 419, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 419, __FUNCTION__))->decl_common.lang_specific); if (!(( (enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL || (((enum tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast <union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 419, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 419, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 419, __FUNCTION__); <->u.fn; })->context : (tree ) __null) |
420 | && same_type_p (DECL_FRIEND_CONTEXT (current_function_decl),comptypes (((((((enum tree_code) (current_function_decl)-> base.code) == FUNCTION_DECL || (((enum tree_code) (current_function_decl )->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) && !((contains_struct_check ((current_function_decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__))->decl_common.virtual_flag) && !((tree_check (((((enum tree_code) (current_function_decl)-> base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)( const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl )), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor )) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast< union tree_node *> ((((tree_check ((current_function_decl) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__))->decl_common.lang_specific); if (!(( (enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL || (((enum tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast <union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__); <->u.fn; })->context : (tree ) __null)), (scope_chain->class_type), 0) |
421 | current_class_type)comptypes (((((((enum tree_code) (current_function_decl)-> base.code) == FUNCTION_DECL || (((enum tree_code) (current_function_decl )->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) && !((contains_struct_check ((current_function_decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__))->decl_common.virtual_flag) && !((tree_check (((((enum tree_code) (current_function_decl)-> base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)( const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl )), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor )) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast< union tree_node *> ((((tree_check ((current_function_decl) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__))->decl_common.lang_specific); if (!(( (enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL || (((enum tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast <union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 420, __FUNCTION__); <->u.fn; })->context : (tree ) __null)), (scope_chain->class_type), 0)))) |
422 | return current_function_decl; |
423 | |
424 | if (current_class_typescope_chain->class_type) |
425 | return current_class_typescope_chain->class_type; |
426 | |
427 | if (current_function_decl) |
428 | return current_function_decl; |
429 | |
430 | return current_namespacescope_chain->old_namespace; |
431 | } |
432 | |
433 | /* Returns nonzero if we are currently in a function scope. Note |
434 | that this function returns zero if we are within a local class, but |
435 | not within a member function body of the local class. */ |
436 | |
437 | int |
438 | at_function_scope_p (void) |
439 | { |
440 | tree cs = current_scope (); |
441 | /* Also check cfun to make sure that we're really compiling |
442 | this function (as opposed to having set current_function_decl |
443 | for access checking or some such). */ |
444 | return (cs && TREE_CODE (cs)((enum tree_code) (cs)->base.code) == FUNCTION_DECL |
445 | && cfun(cfun + 0) && cfun(cfun + 0)->decl == current_function_decl); |
446 | } |
447 | |
448 | /* Returns true if the innermost active scope is a class scope. */ |
449 | |
450 | bool |
451 | at_class_scope_p (void) |
452 | { |
453 | tree cs = current_scope (); |
454 | return cs && TYPE_P (cs)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (cs)->base.code))] == tcc_type); |
455 | } |
456 | |
457 | /* Returns true if the innermost active scope is a namespace scope. */ |
458 | |
459 | bool |
460 | at_namespace_scope_p (void) |
461 | { |
462 | tree cs = current_scope (); |
463 | return cs && TREE_CODE (cs)((enum tree_code) (cs)->base.code) == NAMESPACE_DECL; |
464 | } |
465 | |
466 | /* Return the scope of DECL, as appropriate when doing name-lookup. */ |
467 | |
468 | tree |
469 | context_for_name_lookup (tree decl) |
470 | { |
471 | /* [class.union] |
472 | |
473 | For the purposes of name lookup, after the anonymous union |
474 | definition, the members of the anonymous union are considered to |
475 | have been defined in the scope in which the anonymous union is |
476 | declared. */ |
477 | tree context = DECL_CONTEXT (decl)((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 477, __FUNCTION__))->decl_minimal.context); |
478 | |
479 | while (context && TYPE_P (context)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (context)->base.code))] == tcc_type) |
480 | && (ANON_AGGR_TYPE_P (context)((((((enum tree_code) (context)->base.code)) == RECORD_TYPE || (((enum tree_code) (context)->base.code)) == UNION_TYPE ) && ((tree_class_check ((context), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 480, __FUNCTION__))->type_common.lang_flag_5)) && (((tree_class_check ((context), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 480, __FUNCTION__))->type_with_lang_specific.lang_specific ))->anon_aggr) || UNSCOPED_ENUM_P (context)(((enum tree_code) (context)->base.code) == ENUMERAL_TYPE && !((tree_check ((context), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 480, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)))) |
481 | context = TYPE_CONTEXT (context)((tree_class_check ((context), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 481, __FUNCTION__))->type_common.context); |
482 | if (!context) |
483 | context = global_namespacecp_global_trees[CPTI_GLOBAL]; |
484 | |
485 | return context; |
486 | } |
487 | |
488 | /* Returns true iff DECL is declared in TYPE. */ |
489 | |
490 | static bool |
491 | member_declared_in_type (tree decl, tree type) |
492 | { |
493 | /* A normal declaration obviously counts. */ |
494 | if (context_for_name_lookup (decl) == type) |
495 | return true; |
496 | /* So does a using or access declaration. */ |
497 | if (DECL_LANG_SPECIFIC (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 497, __FUNCTION__))->decl_common.lang_specific) && !DECL_DISCRIMINATOR_P (decl)(((((enum tree_code) (decl)->base.code) == VAR_DECL && ((decl)->base.static_flag)) || (((enum tree_code) (decl)-> base.code) == TYPE_DECL && ((contains_struct_check (( decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 497, __FUNCTION__))->decl_common.lang_flag_2))) && (((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 497, __FUNCTION__))->decl_minimal.context) && (( enum tree_code) (((contains_struct_check ((decl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 497, __FUNCTION__))->decl_minimal.context))->base.code ) == FUNCTION_DECL)) |
498 | && purpose_member (type, DECL_ACCESS (decl)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 498, __FUNCTION__))->decl_common.lang_specific); if (!(( ((enum tree_code) (decl)->base.code) == VAR_DECL || ((enum tree_code) (decl)->base.code) == FUNCTION_DECL) || ((enum tree_code) (decl)->base.code) == FIELD_DECL || ((enum tree_code ) (decl)->base.code) == CONST_DECL || ((enum tree_code) (decl )->base.code) == TYPE_DECL || ((enum tree_code) (decl)-> base.code) == TEMPLATE_DECL || ((enum tree_code) (decl)->base .code) == USING_DECL || ((enum tree_code) (decl)->base.code ) == CONCEPT_DECL)) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 498, __FUNCTION__); <->u.min; })->access))) |
499 | return true; |
500 | return false; |
501 | } |
502 | |
503 | /* The accessibility routines use BINFO_ACCESS for scratch space |
504 | during the computation of the accessibility of some declaration. */ |
505 | |
506 | /* Avoid walking up past a declaration of the member. */ |
507 | |
508 | static tree |
509 | dfs_access_in_type_pre (tree binfo, void *data) |
510 | { |
511 | tree decl = (tree) data; |
512 | tree type = BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 512, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 512, __FUNCTION__))->typed.type); |
513 | if (member_declared_in_type (decl, type)) |
514 | return dfs_skip_bases((tree)1); |
515 | return NULL_TREE(tree) __null; |
516 | } |
517 | |
518 | #define BINFO_ACCESS(NODE)((access_kind) ((((NODE)->base.public_flag) << 1) | ( (NODE)->base.private_flag))) \ |
519 | ((access_kind) ((TREE_PUBLIC (NODE)((NODE)->base.public_flag) << 1) | TREE_PRIVATE (NODE)((NODE)->base.private_flag))) |
520 | |
521 | /* Set the access associated with NODE to ACCESS. */ |
522 | |
523 | #define SET_BINFO_ACCESS(NODE, ACCESS)((((NODE)->base.public_flag) = ((ACCESS) & 2) != 0), ( ((NODE)->base.private_flag) = ((ACCESS) & 1) != 0)) \ |
524 | ((TREE_PUBLIC (NODE)((NODE)->base.public_flag) = ((ACCESS) & 2) != 0), \ |
525 | (TREE_PRIVATE (NODE)((NODE)->base.private_flag) = ((ACCESS) & 1) != 0)) |
526 | |
527 | /* Called from access_in_type via dfs_walk. Calculate the access to |
528 | DATA (which is really a DECL) in BINFO. */ |
529 | |
530 | static tree |
531 | dfs_access_in_type (tree binfo, void *data) |
532 | { |
533 | tree decl = (tree) data; |
534 | tree type = BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 534, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 534, __FUNCTION__))->typed.type); |
535 | access_kind access = ak_none; |
536 | |
537 | if (context_for_name_lookup (decl) == type) |
538 | { |
539 | /* If we have descended to the scope of DECL, just note the |
540 | appropriate access. */ |
541 | if (TREE_PRIVATE (decl)((decl)->base.private_flag)) |
542 | access = ak_private; |
543 | else if (TREE_PROTECTED (decl)((decl)->base.protected_flag)) |
544 | access = ak_protected; |
545 | else |
546 | access = ak_public; |
547 | } |
548 | else |
549 | { |
550 | /* First, check for an access-declaration that gives us more |
551 | access to the DECL. */ |
552 | if (DECL_LANG_SPECIFIC (decl)((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 552, __FUNCTION__))->decl_common.lang_specific) && !DECL_DISCRIMINATOR_P (decl)(((((enum tree_code) (decl)->base.code) == VAR_DECL && ((decl)->base.static_flag)) || (((enum tree_code) (decl)-> base.code) == TYPE_DECL && ((contains_struct_check (( decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 552, __FUNCTION__))->decl_common.lang_flag_2))) && (((contains_struct_check ((decl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 552, __FUNCTION__))->decl_minimal.context) && (( enum tree_code) (((contains_struct_check ((decl), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 552, __FUNCTION__))->decl_minimal.context))->base.code ) == FUNCTION_DECL))) |
553 | { |
554 | tree decl_access = purpose_member (type, DECL_ACCESS (decl)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check ((decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 554, __FUNCTION__))->decl_common.lang_specific); if (!(( ((enum tree_code) (decl)->base.code) == VAR_DECL || ((enum tree_code) (decl)->base.code) == FUNCTION_DECL) || ((enum tree_code) (decl)->base.code) == FIELD_DECL || ((enum tree_code ) (decl)->base.code) == CONST_DECL || ((enum tree_code) (decl )->base.code) == TYPE_DECL || ((enum tree_code) (decl)-> base.code) == TEMPLATE_DECL || ((enum tree_code) (decl)->base .code) == USING_DECL || ((enum tree_code) (decl)->base.code ) == CONCEPT_DECL)) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 554, __FUNCTION__); <->u.min; })->access)); |
555 | |
556 | if (decl_access) |
557 | { |
558 | decl_access = TREE_VALUE (decl_access)((tree_check ((decl_access), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 558, __FUNCTION__, (TREE_LIST)))->list.value); |
559 | |
560 | if (decl_access == access_public_nodeglobal_trees[TI_PUBLIC]) |
561 | access = ak_public; |
562 | else if (decl_access == access_protected_nodeglobal_trees[TI_PROTECTED]) |
563 | access = ak_protected; |
564 | else if (decl_access == access_private_nodeglobal_trees[TI_PRIVATE]) |
565 | access = ak_private; |
566 | else |
567 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 567, __FUNCTION__)); |
568 | } |
569 | } |
570 | |
571 | if (!access) |
572 | { |
573 | int i; |
574 | tree base_binfo; |
575 | vec<tree, va_gc> *accesses; |
576 | |
577 | /* Otherwise, scan our baseclasses, and pick the most favorable |
578 | access. */ |
579 | accesses = BINFO_BASE_ACCESSES (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 579, __FUNCTION__, (TREE_BINFO)))->binfo.base_accesses); |
580 | for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo)((&(tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 580, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)-> iterate ((i), &(base_binfo))); i++) |
581 | { |
582 | tree base_access = (*accesses)[i]; |
583 | access_kind base_access_now = BINFO_ACCESS (base_binfo)((access_kind) ((((base_binfo)->base.public_flag) << 1) | ((base_binfo)->base.private_flag))); |
584 | |
585 | if (base_access_now == ak_none || base_access_now == ak_private) |
586 | /* If it was not accessible in the base, or only |
587 | accessible as a private member, we can't access it |
588 | all. */ |
589 | base_access_now = ak_none; |
590 | else if (base_access == access_protected_nodeglobal_trees[TI_PROTECTED]) |
591 | /* Public and protected members in the base become |
592 | protected here. */ |
593 | base_access_now = ak_protected; |
594 | else if (base_access == access_private_nodeglobal_trees[TI_PRIVATE]) |
595 | /* Public and protected members in the base become |
596 | private here. */ |
597 | base_access_now = ak_private; |
598 | |
599 | /* See if the new access, via this base, gives more |
600 | access than our previous best access. */ |
601 | if (base_access_now != ak_none |
602 | && (access == ak_none || base_access_now < access)) |
603 | { |
604 | access = base_access_now; |
605 | |
606 | /* If the new access is public, we can't do better. */ |
607 | if (access == ak_public) |
608 | break; |
609 | } |
610 | } |
611 | } |
612 | } |
613 | |
614 | /* Note the access to DECL in TYPE. */ |
615 | SET_BINFO_ACCESS (binfo, access)((((binfo)->base.public_flag) = ((access) & 2) != 0), ( ((binfo)->base.private_flag) = ((access) & 1) != 0)); |
616 | |
617 | return NULL_TREE(tree) __null; |
618 | } |
619 | |
620 | /* Return the access to DECL in TYPE. */ |
621 | |
622 | static access_kind |
623 | access_in_type (tree type, tree decl) |
624 | { |
625 | tree binfo = TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 625, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval); |
626 | |
627 | /* We must take into account |
628 | |
629 | [class.paths] |
630 | |
631 | If a name can be reached by several paths through a multiple |
632 | inheritance graph, the access is that of the path that gives |
633 | most access. |
634 | |
635 | The algorithm we use is to make a post-order depth-first traversal |
636 | of the base-class hierarchy. As we come up the tree, we annotate |
637 | each node with the most lenient access. */ |
638 | dfs_walk_once (binfo, dfs_access_in_type_pre, dfs_access_in_type, decl); |
639 | |
640 | return BINFO_ACCESS (binfo)((access_kind) ((((binfo)->base.public_flag) << 1) | ((binfo)->base.private_flag))); |
641 | } |
642 | |
643 | /* Returns nonzero if it is OK to access DECL named in TYPE through an object |
644 | of OTYPE in the context of DERIVED. */ |
645 | |
646 | static int |
647 | protected_accessible_p (tree decl, tree derived, tree type, tree otype) |
648 | { |
649 | /* We're checking this clause from [class.access.base] |
650 | |
651 | m as a member of N is protected, and the reference occurs in a |
652 | member or friend of class N, or in a member or friend of a |
653 | class P derived from N, where m as a member of P is public, private |
654 | or protected. |
655 | |
656 | Here DERIVED is a possible P, DECL is m and TYPE is N. */ |
657 | |
658 | /* If DERIVED isn't derived from N, then it can't be a P. */ |
659 | if (!DERIVED_FROM_P (type, derived)(lookup_base ((derived), (type), ba_any, __null, tf_none) != ( tree) __null)) |
660 | return 0; |
661 | |
662 | /* DECL_NONSTATIC_MEMBER_P won't work for USING_DECLs. */ |
663 | decl = strip_using_decl (decl); |
664 | /* We don't expect or support dependent decls. */ |
665 | gcc_assert (TREE_CODE (decl) != USING_DECL)((void)(!(((enum tree_code) (decl)->base.code) != USING_DECL ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 665, __FUNCTION__), 0 : 0)); |
666 | |
667 | /* [class.protected] |
668 | |
669 | When a friend or a member function of a derived class references |
670 | a protected non-static member of a base class, an access check |
671 | applies in addition to those described earlier in clause |
672 | _class.access_) Except when forming a pointer to member |
673 | (_expr.unary.op_), the access must be through a pointer to, |
674 | reference to, or object of the derived class itself (or any class |
675 | derived from that class) (_expr.ref_). If the access is to form |
676 | a pointer to member, the nested-name-specifier shall name the |
677 | derived class (or any class derived from that class). */ |
678 | if (DECL_NONSTATIC_MEMBER_P (decl)((((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 678, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE ) || ((enum tree_code) (decl)->base.code) == FIELD_DECL) |
679 | && !DERIVED_FROM_P (derived, otype)(lookup_base ((otype), (derived), ba_any, __null, tf_none) != (tree) __null)) |
680 | return 0; |
681 | |
682 | return 1; |
683 | } |
684 | |
685 | /* Returns nonzero if SCOPE is a type or a friend of a type which would be able |
686 | to access DECL through TYPE. OTYPE is the type of the object. */ |
687 | |
688 | static int |
689 | friend_accessible_p (tree scope, tree decl, tree type, tree otype) |
690 | { |
691 | /* We're checking this clause from [class.access.base] |
692 | |
693 | m as a member of N is protected, and the reference occurs in a |
694 | member or friend of class N, or in a member or friend of a |
695 | class P derived from N, where m as a member of P is public, private |
696 | or protected. |
697 | |
698 | Here DECL is m and TYPE is N. SCOPE is the current context, |
699 | and we check all its possible Ps. */ |
700 | tree befriending_classes; |
701 | tree t; |
702 | |
703 | if (!scope) |
704 | return 0; |
705 | |
706 | if (is_global_friend (scope)) |
707 | return 1; |
708 | |
709 | /* Is SCOPE itself a suitable P? */ |
710 | if (TYPE_P (scope)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (scope)->base.code))] == tcc_type) && protected_accessible_p (decl, scope, type, otype)) |
711 | return 1; |
712 | |
713 | if (DECL_DECLARES_FUNCTION_P (scope)(((enum tree_code) (scope)->base.code) == FUNCTION_DECL || (((enum tree_code) (scope)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 713, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 713, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL))) |
714 | befriending_classes = DECL_BEFRIENDING_CLASSES (scope)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (scope)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 714, __FUNCTION__, (TEMPLATE_DECL))))))))->result : scope )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 714, __FUNCTION__))->decl_common.lang_specific); if (!(( (enum tree_code) (scope)->base.code) == FUNCTION_DECL || ( ((enum tree_code) (scope)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 714, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 714, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 714, __FUNCTION__); <->u.fn; })->befriending_classes ); |
715 | else if (TYPE_P (scope)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (scope)->base.code))] == tcc_type)) |
716 | befriending_classes = CLASSTYPE_BEFRIENDING_CLASSES (scope)((((tree_class_check ((scope), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 716, __FUNCTION__))->type_with_lang_specific.lang_specific ))->befriending_classes); |
717 | else |
718 | return 0; |
719 | |
720 | for (t = befriending_classes; t; t = TREE_CHAIN (t)((contains_struct_check ((t), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 720, __FUNCTION__))->common.chain)) |
721 | if (protected_accessible_p (decl, TREE_VALUE (t)((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 721, __FUNCTION__, (TREE_LIST)))->list.value), type, otype)) |
722 | return 1; |
723 | |
724 | /* Nested classes have the same access as their enclosing types, as |
725 | per DR 45 (this is a change from C++98). */ |
726 | if (TYPE_P (scope)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (scope)->base.code))] == tcc_type)) |
727 | if (friend_accessible_p (TYPE_CONTEXT (scope)((tree_class_check ((scope), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 727, __FUNCTION__))->type_common.context), decl, type, otype)) |
728 | return 1; |
729 | |
730 | if (DECL_DECLARES_FUNCTION_P (scope)(((enum tree_code) (scope)->base.code) == FUNCTION_DECL || (((enum tree_code) (scope)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 730, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 730, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL))) |
731 | { |
732 | /* Perhaps this SCOPE is a member of a class which is a |
733 | friend. */ |
734 | if (DECL_CLASS_SCOPE_P (scope)(((contains_struct_check ((scope), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 734, __FUNCTION__))->decl_minimal.context) && (tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code) (((contains_struct_check ((scope), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 734, __FUNCTION__))->decl_minimal.context))->base.code ))] == tcc_type)) |
735 | && friend_accessible_p (DECL_CONTEXT (scope)((contains_struct_check ((scope), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 735, __FUNCTION__))->decl_minimal.context), decl, type, otype)) |
736 | return 1; |
737 | /* Perhaps SCOPE is a friend function defined inside a class from which |
738 | DECL is accessible. */ |
739 | if (tree fctx = DECL_FRIEND_CONTEXT (scope)(((((enum tree_code) (scope)->base.code) == FUNCTION_DECL || (((enum tree_code) (scope)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 739, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 739, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) && !((contains_struct_check ((scope), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 739, __FUNCTION__))->decl_common.virtual_flag) && !((tree_check (((((enum tree_code) (scope)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast< union tree_node *> ((((tree_check ((scope), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 739, __FUNCTION__, (TEMPLATE_DECL))))))))->result : scope )), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 739, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor )) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (scope)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 739, __FUNCTION__, (TEMPLATE_DECL))))))))->result : scope )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 739, __FUNCTION__))->decl_common.lang_specific); if (!(( (enum tree_code) (scope)->base.code) == FUNCTION_DECL || ( ((enum tree_code) (scope)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 739, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((scope ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 739, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 739, __FUNCTION__); <->u.fn; })->context : (tree ) __null)) |
740 | if (friend_accessible_p (fctx, decl, type, otype)) |
741 | return 1; |
742 | } |
743 | |
744 | /* Maybe scope's template is a friend. */ |
745 | if (tree tinfo = get_template_info (scope)) |
746 | { |
747 | tree tmpl = TI_TEMPLATE (tinfo)((struct tree_template_info*)(tree_check ((tinfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 747, __FUNCTION__, (TEMPLATE_INFO))))->tmpl; |
748 | if (DECL_CLASS_TEMPLATE_P (tmpl)((((enum tree_code) (tmpl)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((tmpl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 748, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((tmpl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 748, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == TYPE_DECL) && (((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((tmpl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 748, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == TYPE_DECL && ((contains_struct_check ((((struct tree_template_decl *)(const_cast<union tree_node *> (( ((tree_check ((tmpl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 748, __FUNCTION__, (TEMPLATE_DECL))))))))->result), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 748, __FUNCTION__))->decl_common.lang_flag_2)))) |
749 | tmpl = TREE_TYPE (tmpl)((contains_struct_check ((tmpl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 749, __FUNCTION__))->typed.type); |
750 | else |
751 | tmpl = DECL_TEMPLATE_RESULT (tmpl)((struct tree_template_decl *)(const_cast<union tree_node * > ((((tree_check ((tmpl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 751, __FUNCTION__, (TEMPLATE_DECL))))))))->result; |
752 | if (tmpl != scope) |
753 | { |
754 | /* Increment processing_template_decl to make sure that |
755 | dependent_type_p works correctly. */ |
756 | ++processing_template_declscope_chain->x_processing_template_decl; |
757 | int ret = friend_accessible_p (tmpl, decl, type, otype); |
758 | --processing_template_declscope_chain->x_processing_template_decl; |
759 | if (ret) |
760 | return 1; |
761 | } |
762 | } |
763 | |
764 | /* If is_friend is true, we should have found a befriending class. */ |
765 | gcc_checking_assert (!is_friend (type, scope))((void)(!(!is_friend (type, scope)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 765, __FUNCTION__), 0 : 0)); |
766 | |
767 | return 0; |
768 | } |
769 | |
770 | struct dfs_accessible_data |
771 | { |
772 | tree decl; |
773 | tree object_type; |
774 | }; |
775 | |
776 | /* Avoid walking up past a declaration of the member. */ |
777 | |
778 | static tree |
779 | dfs_accessible_pre (tree binfo, void *data) |
780 | { |
781 | dfs_accessible_data *d = (dfs_accessible_data *)data; |
782 | tree type = BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 782, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 782, __FUNCTION__))->typed.type); |
783 | if (member_declared_in_type (d->decl, type)) |
784 | return dfs_skip_bases((tree)1); |
785 | return NULL_TREE(tree) __null; |
786 | } |
787 | |
788 | /* Called via dfs_walk_once_accessible from accessible_p */ |
789 | |
790 | static tree |
791 | dfs_accessible_post (tree binfo, void *data) |
792 | { |
793 | /* access_in_type already set BINFO_ACCESS for us. */ |
794 | access_kind access = BINFO_ACCESS (binfo)((access_kind) ((((binfo)->base.public_flag) << 1) | ((binfo)->base.private_flag))); |
795 | tree N = BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 795, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 795, __FUNCTION__))->typed.type); |
796 | dfs_accessible_data *d = (dfs_accessible_data *)data; |
797 | tree decl = d->decl; |
798 | tree scope = current_nonlambda_scope (); |
799 | |
800 | /* A member m is accessible at the point R when named in class N if */ |
801 | switch (access) |
802 | { |
803 | case ak_none: |
804 | return NULL_TREE(tree) __null; |
805 | |
806 | case ak_public: |
807 | /* m as a member of N is public, or */ |
808 | return binfo; |
809 | |
810 | case ak_private: |
811 | { |
812 | /* m as a member of N is private, and R occurs in a member or friend of |
813 | class N, or */ |
814 | if (scope && TREE_CODE (scope)((enum tree_code) (scope)->base.code) != NAMESPACE_DECL |
815 | && is_friend (N, scope)) |
816 | return binfo; |
817 | return NULL_TREE(tree) __null; |
818 | } |
819 | |
820 | case ak_protected: |
821 | { |
822 | /* m as a member of N is protected, and R occurs in a member or friend |
823 | of class N, or in a member or friend of a class P derived from N, |
824 | where m as a member of P is public, private, or protected */ |
825 | if (friend_accessible_p (scope, decl, N, d->object_type)) |
826 | return binfo; |
827 | return NULL_TREE(tree) __null; |
828 | } |
829 | |
830 | default: |
831 | gcc_unreachable ()(fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 831, __FUNCTION__)); |
832 | } |
833 | } |
834 | |
835 | /* Like accessible_p below, but within a template returns true iff DECL is |
836 | accessible in TYPE to all possible instantiations of the template. */ |
837 | |
838 | int |
839 | accessible_in_template_p (tree type, tree decl) |
840 | { |
841 | int save_ptd = processing_template_declscope_chain->x_processing_template_decl; |
842 | processing_template_declscope_chain->x_processing_template_decl = 0; |
843 | int val = accessible_p (type, decl, false); |
844 | processing_template_declscope_chain->x_processing_template_decl = save_ptd; |
845 | return val; |
846 | } |
847 | |
848 | /* DECL is a declaration from a base class of TYPE, which was the |
849 | class used to name DECL. Return nonzero if, in the current |
850 | context, DECL is accessible. If TYPE is actually a BINFO node, |
851 | then we can tell in what context the access is occurring by looking |
852 | at the most derived class along the path indicated by BINFO. If |
853 | CONSIDER_LOCAL is true, do consider special access the current |
854 | scope or friendship thereof we might have. */ |
855 | |
856 | int |
857 | accessible_p (tree type, tree decl, bool consider_local_p) |
858 | { |
859 | tree binfo; |
860 | access_kind access; |
861 | |
862 | /* If this declaration is in a block or namespace scope, there's no |
863 | access control. */ |
864 | if (!TYPE_P (context_for_name_lookup (decl))(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (context_for_name_lookup (decl))->base.code))] == tcc_type )) |
865 | return 1; |
866 | |
867 | /* There is no need to perform access checks inside a thunk. */ |
868 | if (current_function_decl && DECL_THUNK_P (current_function_decl)(((enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL && ((contains_struct_check ((current_function_decl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 868, __FUNCTION__))->decl_common.lang_specific) && __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast< union tree_node *> ((((tree_check ((current_function_decl) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 868, __FUNCTION__, (TEMPLATE_DECL))))))))->result : current_function_decl )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 868, __FUNCTION__))->decl_common.lang_specific); if (!(( (enum tree_code) (current_function_decl)->base.code) == FUNCTION_DECL || (((enum tree_code) (current_function_decl)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast <union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 868, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((current_function_decl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 868, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base .code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 868, __FUNCTION__); <->u.fn; })->thunk_p)) |
869 | return 1; |
870 | |
871 | tree otype = NULL_TREE(tree) __null; |
872 | if (!TYPE_P (type)(tree_code_type_tmpl <0>::tree_code_type[(int) (((enum tree_code ) (type)->base.code))] == tcc_type)) |
873 | { |
874 | /* When accessing a non-static member, the most derived type in the |
875 | binfo chain is the type of the object; remember that type for |
876 | protected_accessible_p. */ |
877 | for (tree b = type; b; b = BINFO_INHERITANCE_CHAIN (b)((tree_check ((b), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 877, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance)) |
878 | otype = BINFO_TYPE (b)((contains_struct_check (((tree_check ((b), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 878, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 878, __FUNCTION__))->typed.type); |
879 | type = BINFO_TYPE (type)((contains_struct_check (((tree_check ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 879, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 879, __FUNCTION__))->typed.type); |
880 | } |
881 | else |
882 | otype = type; |
883 | |
884 | /* [class.access.base] |
885 | |
886 | A member m is accessible when named in class N if |
887 | |
888 | --m as a member of N is public, or |
889 | |
890 | --m as a member of N is private, and the reference occurs in a |
891 | member or friend of class N, or |
892 | |
893 | --m as a member of N is protected, and the reference occurs in a |
894 | member or friend of class N, or in a member or friend of a |
895 | class P derived from N, where m as a member of P is public, private or |
896 | protected, or |
897 | |
898 | --there exists a base class B of N that is accessible at the point |
899 | of reference, and m is accessible when named in class B. |
900 | |
901 | We walk the base class hierarchy, checking these conditions. */ |
902 | |
903 | /* We walk using TYPE_BINFO (type) because access_in_type will set |
904 | BINFO_ACCESS on it and its bases. */ |
905 | binfo = TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 905, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval); |
906 | |
907 | /* Compute the accessibility of DECL in the class hierarchy |
908 | dominated by type. */ |
909 | access = access_in_type (type, decl); |
910 | if (access == ak_public) |
911 | return 1; |
912 | |
913 | /* If we aren't considering the point of reference, only the first bullet |
914 | applies. */ |
915 | if (!consider_local_p) |
916 | return 0; |
917 | |
918 | dfs_accessible_data d = { decl, otype }; |
919 | |
920 | /* Walk the hierarchy again, looking for a base class that allows |
921 | access. */ |
922 | return dfs_walk_once_accessible (binfo, /*friends=*/true, |
923 | dfs_accessible_pre, |
924 | dfs_accessible_post, &d) |
925 | != NULL_TREE(tree) __null; |
926 | } |
927 | |
928 | struct lookup_field_info { |
929 | /* The type in which we're looking. */ |
930 | tree type; |
931 | /* The name of the field for which we're looking. */ |
932 | tree name; |
933 | /* If non-NULL, the current result of the lookup. */ |
934 | tree rval; |
935 | /* The path to RVAL. */ |
936 | tree rval_binfo; |
937 | /* If non-NULL, the lookup was ambiguous, and this is a list of the |
938 | candidates. */ |
939 | tree ambiguous; |
940 | /* If nonzero, we are looking for types, not data members. */ |
941 | int want_type; |
942 | }; |
943 | |
944 | /* True for a class member means that it is shared between all objects |
945 | of that class. |
946 | |
947 | [class.member.lookup]:If the resulting set of declarations are not all |
948 | from sub-objects of the same type, or the set has a non-static member |
949 | and includes members from distinct sub-objects, there is an ambiguity |
950 | and the program is ill-formed. |
951 | |
952 | This function checks that T contains no non-static members. */ |
953 | |
954 | bool |
955 | shared_member_p (tree t) |
956 | { |
957 | if (VAR_P (t)(((enum tree_code) (t)->base.code) == VAR_DECL) || TREE_CODE (t)((enum tree_code) (t)->base.code) == TYPE_DECL |
958 | || TREE_CODE (t)((enum tree_code) (t)->base.code) == CONST_DECL) |
959 | return true; |
960 | if (is_overloaded_fn (t)) |
961 | { |
962 | for (ovl_iterator iter (get_fns (t)); iter; ++iter) |
963 | { |
964 | tree decl = strip_using_decl (*iter); |
965 | if (TREE_CODE (decl)((enum tree_code) (decl)->base.code) == USING_DECL) |
966 | /* Conservatively assume a dependent using-declaration |
967 | might resolve to a non-static member. */ |
968 | return false; |
969 | if (DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)(((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 969, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE )) |
970 | return false; |
971 | } |
972 | return true; |
973 | } |
974 | return false; |
975 | } |
976 | |
977 | /* Routine to see if the sub-object denoted by the binfo PARENT can be |
978 | found as a base class and sub-object of the object denoted by |
979 | BINFO. */ |
980 | |
981 | static int |
982 | is_subobject_of_p (tree parent, tree binfo) |
983 | { |
984 | tree probe; |
985 | |
986 | for (probe = parent; probe; probe = BINFO_INHERITANCE_CHAIN (probe)((tree_check ((probe), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 986, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance)) |
987 | { |
988 | if (probe == binfo) |
989 | return 1; |
990 | if (BINFO_VIRTUAL_P (probe)((tree_check ((probe), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 990, __FUNCTION__, (TREE_BINFO)))->base.static_flag)) |
991 | return (binfo_for_vbase (BINFO_TYPE (probe)((contains_struct_check (((tree_check ((probe), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 991, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 991, __FUNCTION__))->typed.type), BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 991, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 991, __FUNCTION__))->typed.type)) |
992 | != NULL_TREE(tree) __null); |
993 | } |
994 | return 0; |
995 | } |
996 | |
997 | /* DATA is really a struct lookup_field_info. Look for a field with |
998 | the name indicated there in BINFO. If this function returns a |
999 | non-NULL value it is the result of the lookup. Called from |
1000 | lookup_field via breadth_first_search. */ |
1001 | |
1002 | static tree |
1003 | lookup_field_r (tree binfo, void *data) |
1004 | { |
1005 | struct lookup_field_info *lfi = (struct lookup_field_info *) data; |
1006 | tree type = BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1006, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1006, __FUNCTION__))->typed.type); |
1007 | tree nval = NULL_TREE(tree) __null; |
1008 | |
1009 | /* If this is a dependent base, don't look in it. */ |
1010 | if (BINFO_DEPENDENT_BASE_P (binfo)((tree_not_check2 (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1010, __FUNCTION__, (TREE_BINFO)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1010, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_3)) |
1011 | return NULL_TREE(tree) __null; |
1012 | |
1013 | /* If this base class is hidden by the best-known value so far, we |
1014 | don't need to look. */ |
1015 | if (lfi->rval_binfo && BINFO_INHERITANCE_CHAIN (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1015, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance) == lfi->rval_binfo |
1016 | && !BINFO_VIRTUAL_P (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1016, __FUNCTION__, (TREE_BINFO)))->base.static_flag)) |
1017 | return dfs_skip_bases((tree)1); |
1018 | |
1019 | nval = get_class_binding (type, lfi->name, lfi->want_type); |
1020 | |
1021 | /* If there is no declaration with the indicated name in this type, |
1022 | then there's nothing to do. */ |
1023 | if (!nval) |
1024 | goto done; |
1025 | |
1026 | /* If the lookup already found a match, and the new value doesn't |
1027 | hide the old one, we might have an ambiguity. */ |
1028 | if (lfi->rval_binfo |
1029 | && !is_subobject_of_p (lfi->rval_binfo, binfo)) |
1030 | |
1031 | { |
1032 | if (nval == lfi->rval && shared_member_p (nval)) |
1033 | /* The two things are really the same. */ |
1034 | ; |
1035 | else if (is_subobject_of_p (binfo, lfi->rval_binfo)) |
1036 | /* The previous value hides the new one. */ |
1037 | ; |
1038 | else |
1039 | { |
1040 | /* We have a real ambiguity. We keep a chain of all the |
1041 | candidates. */ |
1042 | if (!lfi->ambiguous && lfi->rval) |
1043 | { |
1044 | /* This is the first time we noticed an ambiguity. Add |
1045 | what we previously thought was a reasonable candidate |
1046 | to the list. */ |
1047 | lfi->ambiguous = tree_cons (NULL_TREE(tree) __null, lfi->rval, NULL_TREE(tree) __null); |
1048 | TREE_TYPE (lfi->ambiguous)((contains_struct_check ((lfi->ambiguous), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1048, __FUNCTION__))->typed.type) = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
1049 | } |
1050 | |
1051 | /* Add the new value. */ |
1052 | lfi->ambiguous = tree_cons (NULL_TREE(tree) __null, nval, lfi->ambiguous); |
1053 | TREE_TYPE (lfi->ambiguous)((contains_struct_check ((lfi->ambiguous), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1053, __FUNCTION__))->typed.type) = error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
1054 | } |
1055 | } |
1056 | else |
1057 | { |
1058 | lfi->rval = nval; |
1059 | lfi->rval_binfo = binfo; |
1060 | } |
1061 | |
1062 | done: |
1063 | /* Don't look for constructors or destructors in base classes. */ |
1064 | if (IDENTIFIER_CDTOR_P (lfi->name)((!((tree_not_check2 (((tree_check ((lfi->name), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1064, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1064, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_2)) & ((tree_not_check2 (((tree_check ((lfi-> name), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1064, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1064, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1))) |
1065 | return dfs_skip_bases((tree)1); |
1066 | return NULL_TREE(tree) __null; |
1067 | } |
1068 | |
1069 | /* Return a "baselink" with BASELINK_BINFO, BASELINK_ACCESS_BINFO, |
1070 | BASELINK_FUNCTIONS, and BASELINK_OPTYPE set to BINFO, ACCESS_BINFO, |
1071 | FUNCTIONS, and OPTYPE respectively. */ |
1072 | |
1073 | tree |
1074 | build_baselink (tree binfo, tree access_binfo, tree functions, tree optype) |
1075 | { |
1076 | tree baselink; |
1077 | |
1078 | gcc_assert (OVL_P (functions) || TREE_CODE (functions) == TEMPLATE_ID_EXPR)((void)(!((((enum tree_code) (functions)->base.code) == FUNCTION_DECL || ((enum tree_code) (functions)->base.code) == OVERLOAD) || ((enum tree_code) (functions)->base.code) == TEMPLATE_ID_EXPR ) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1078, __FUNCTION__), 0 : 0)); |
1079 | gcc_assert (!optype || TYPE_P (optype))((void)(!(!optype || (tree_code_type_tmpl <0>::tree_code_type [(int) (((enum tree_code) (optype)->base.code))] == tcc_type )) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1079, __FUNCTION__), 0 : 0)); |
1080 | gcc_assert (TREE_TYPE (functions))((void)(!(((contains_struct_check ((functions), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1080, __FUNCTION__))->typed.type)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1080, __FUNCTION__), 0 : 0)); |
1081 | |
1082 | baselink = make_node (BASELINK); |
1083 | TREE_TYPE (baselink)((contains_struct_check ((baselink), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1083, __FUNCTION__))->typed.type) = TREE_TYPE (functions)((contains_struct_check ((functions), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1083, __FUNCTION__))->typed.type); |
1084 | BASELINK_BINFO (baselink)(((struct tree_baselink*) (tree_check ((baselink), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1084, __FUNCTION__, (BASELINK))))->binfo) = binfo; |
1085 | BASELINK_ACCESS_BINFO (baselink)(((struct tree_baselink*) (tree_check ((baselink), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1085, __FUNCTION__, (BASELINK))))->access_binfo) = access_binfo; |
1086 | BASELINK_FUNCTIONS (baselink)(((struct tree_baselink*) (tree_check ((baselink), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1086, __FUNCTION__, (BASELINK))))->functions) = functions; |
1087 | BASELINK_OPTYPE (baselink)(((contains_struct_check (((tree_check ((baselink), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1087, __FUNCTION__, (BASELINK)))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1087, __FUNCTION__))->common.chain)) = optype; |
1088 | |
1089 | if (binfo == access_binfo |
1090 | && TYPE_BEING_DEFINED (BINFO_TYPE (access_binfo))((((tree_class_check ((((contains_struct_check (((tree_check ( (access_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1090, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1090, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1090, __FUNCTION__))->type_with_lang_specific.lang_specific ))->being_defined)) |
1091 | BASELINK_FUNCTIONS_MAYBE_INCOMPLETE_P (baselink)((tree_not_check2 (((tree_check ((baselink), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1091, __FUNCTION__, (BASELINK)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1091, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1) = true; |
1092 | |
1093 | return baselink; |
1094 | } |
1095 | |
1096 | /* Look for a member named NAME in an inheritance lattice dominated by |
1097 | XBASETYPE. If PROTECT is 0 or two, we do not check access. If it |
1098 | is 1, we enforce accessibility. If PROTECT is zero, then, for an |
1099 | ambiguous lookup, we return NULL. If PROTECT is 1, we issue error |
1100 | messages about inaccessible or ambiguous lookup. If PROTECT is 2, |
1101 | we return a TREE_LIST whose TREE_TYPE is error_mark_node and whose |
1102 | TREE_VALUEs are the list of ambiguous candidates. |
1103 | |
1104 | WANT_TYPE is 1 when we should only return TYPE_DECLs. |
1105 | |
1106 | If nothing can be found return NULL_TREE and do not issue an error. |
1107 | |
1108 | If non-NULL, failure information is written back to AFI. */ |
1109 | |
1110 | tree |
1111 | lookup_member (tree xbasetype, tree name, int protect, bool want_type, |
1112 | tsubst_flags_t complain, access_failure_info *afi /* = NULL */) |
1113 | { |
1114 | tree rval, rval_binfo = NULL_TREE(tree) __null; |
1115 | tree type = NULL_TREE(tree) __null, basetype_path = NULL_TREE(tree) __null; |
1116 | struct lookup_field_info lfi; |
1117 | |
1118 | /* rval_binfo is the binfo associated with the found member, note, |
1119 | this can be set with useful information, even when rval is not |
1120 | set, because it must deal with ALL members, not just non-function |
1121 | members. It is used for ambiguity checking and the hidden |
1122 | checks. Whereas rval is only set if a proper (not hidden) |
1123 | non-function member is found. */ |
1124 | |
1125 | if (name == error_mark_nodeglobal_trees[TI_ERROR_MARK] |
1126 | || xbasetype == NULL_TREE(tree) __null |
1127 | || xbasetype == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
1128 | return NULL_TREE(tree) __null; |
1129 | |
1130 | gcc_assert (identifier_p (name))((void)(!(identifier_p (name)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1130, __FUNCTION__), 0 : 0)); |
1131 | |
1132 | if (TREE_CODE (xbasetype)((enum tree_code) (xbasetype)->base.code) == TREE_BINFO) |
1133 | { |
1134 | type = BINFO_TYPE (xbasetype)((contains_struct_check (((tree_check ((xbasetype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1134, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1134, __FUNCTION__))->typed.type); |
1135 | basetype_path = xbasetype; |
1136 | } |
1137 | else |
1138 | { |
1139 | if (!RECORD_OR_UNION_CODE_P (TREE_CODE (xbasetype))((((enum tree_code) (xbasetype)->base.code)) == RECORD_TYPE || (((enum tree_code) (xbasetype)->base.code)) == UNION_TYPE )) |
1140 | return NULL_TREE(tree) __null; |
1141 | type = xbasetype; |
1142 | xbasetype = NULL_TREE(tree) __null; |
1143 | } |
1144 | |
1145 | type = complete_type (type); |
1146 | |
1147 | /* Make sure we're looking for a member of the current instantiation in the |
1148 | right partial specialization. */ |
1149 | if (dependent_type_p (type)) |
1150 | if (tree t = currently_open_class (type)) |
1151 | type = t; |
1152 | |
1153 | if (!basetype_path) |
1154 | basetype_path = TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1154, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval); |
1155 | |
1156 | if (!basetype_path) |
1157 | return NULL_TREE(tree) __null; |
1158 | |
1159 | memset (&lfi, 0, sizeof (lfi)); |
1160 | lfi.type = type; |
1161 | lfi.name = name; |
1162 | lfi.want_type = want_type; |
1163 | dfs_walk_all (basetype_path, &lookup_field_r, NULL__null, &lfi); |
1164 | rval = lfi.rval; |
1165 | rval_binfo = lfi.rval_binfo; |
1166 | if (rval_binfo) |
1167 | type = BINFO_TYPE (rval_binfo)((contains_struct_check (((tree_check ((rval_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1167, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1167, __FUNCTION__))->typed.type); |
Value stored to 'type' is never read | |
1168 | |
1169 | if (lfi.ambiguous) |
1170 | { |
1171 | if (protect == 0) |
1172 | return NULL_TREE(tree) __null; |
1173 | else if (protect == 1) |
1174 | { |
1175 | if (complain & tf_error) |
1176 | { |
1177 | error ("request for member %qD is ambiguous", name); |
1178 | print_candidates (lfi.ambiguous); |
1179 | } |
1180 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
1181 | } |
1182 | else if (protect == 2) |
1183 | return lfi.ambiguous; |
1184 | } |
1185 | |
1186 | if (!rval) |
1187 | return NULL_TREE(tree) __null; |
1188 | |
1189 | /* [class.access] |
1190 | |
1191 | In the case of overloaded function names, access control is |
1192 | applied to the function selected by overloaded resolution. |
1193 | |
1194 | We cannot check here, even if RVAL is only a single non-static |
1195 | member function, since we do not know what the "this" pointer |
1196 | will be. For: |
1197 | |
1198 | class A { protected: void f(); }; |
1199 | class B : public A { |
1200 | void g(A *p) { |
1201 | f(); // OK |
1202 | p->f(); // Not OK. |
1203 | } |
1204 | }; |
1205 | |
1206 | only the first call to "f" is valid. However, if the function is |
1207 | static, we can check. */ |
1208 | if (protect == 1 && !really_overloaded_fn (rval)) |
1209 | { |
1210 | tree decl = is_overloaded_fn (rval) ? get_first_fn (rval) : rval; |
1211 | decl = strip_using_decl (decl); |
1212 | /* A dependent USING_DECL will be checked after tsubsting. */ |
1213 | if (TREE_CODE (decl)((enum tree_code) (decl)->base.code) != USING_DECL |
1214 | && !DECL_NONSTATIC_MEMBER_FUNCTION_P (decl)(((enum tree_code) (((contains_struct_check ((decl), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1214, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE ) |
1215 | && !perform_or_defer_access_check (basetype_path, decl, decl, |
1216 | complain, afi)) |
1217 | return error_mark_nodeglobal_trees[TI_ERROR_MARK]; |
1218 | } |
1219 | |
1220 | if (is_overloaded_fn (rval) |
1221 | /* Don't use a BASELINK for class-scope deduction guides since |
1222 | they're not actually member functions. */ |
1223 | && !dguide_name_p (name)) |
1224 | rval = build_baselink (rval_binfo, basetype_path, rval, |
1225 | (IDENTIFIER_CONV_OP_P (name)((((tree_not_check2 (((tree_check ((name), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1225, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1225, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_2)) & ((tree_not_check2 (((tree_check ((name), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1225, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1225, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1) & (!((tree_not_check2 (((tree_check ((name) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1225, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1225, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0))) |
1226 | ? TREE_TYPE (name)((contains_struct_check ((name), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1226, __FUNCTION__))->typed.type): NULL_TREE(tree) __null)); |
1227 | return rval; |
1228 | } |
1229 | |
1230 | /* Helper class for lookup_member_fuzzy. */ |
1231 | |
1232 | class lookup_field_fuzzy_info |
1233 | { |
1234 | public: |
1235 | lookup_field_fuzzy_info (bool want_type_p) : |
1236 | m_want_type_p (want_type_p), m_candidates () {} |
1237 | |
1238 | void fuzzy_lookup_field (tree type); |
1239 | |
1240 | /* If true, we are looking for types, not data members. */ |
1241 | bool m_want_type_p; |
1242 | /* The result: a vec of identifiers. */ |
1243 | auto_vec<tree> m_candidates; |
1244 | }; |
1245 | |
1246 | /* Locate all fields within TYPE, append them to m_candidates. */ |
1247 | |
1248 | void |
1249 | lookup_field_fuzzy_info::fuzzy_lookup_field (tree type) |
1250 | { |
1251 | if (!CLASS_TYPE_P (type)(((((enum tree_code) (type)->base.code)) == RECORD_TYPE || (((enum tree_code) (type)->base.code)) == UNION_TYPE) && ((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1251, __FUNCTION__))->type_common.lang_flag_5))) |
1252 | return; |
1253 | |
1254 | for (tree field = TYPE_FIELDS (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1254, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.values); field; field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), ( TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1254, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1254, __FUNCTION__))->common.chain))) |
1255 | { |
1256 | if (m_want_type_p && !DECL_DECLARES_TYPE_P (field)(((enum tree_code) (field)->base.code) == TYPE_DECL || ((( enum tree_code) (field)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((field), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1256, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((field ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1256, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == TYPE_DECL))) |
1257 | continue; |
1258 | |
1259 | if (!DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1259, __FUNCTION__))->decl_minimal.name)) |
1260 | continue; |
1261 | |
1262 | if (is_lambda_ignored_entity (field)) |
1263 | continue; |
1264 | |
1265 | /* Ignore special identifiers with space at the end like cdtor or |
1266 | conversion op identifiers. */ |
1267 | if (TREE_CODE (DECL_NAME (field))((enum tree_code) (((contains_struct_check ((field), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1267, __FUNCTION__))->decl_minimal.name))->base.code) == IDENTIFIER_NODE) |
1268 | if (unsigned int len = IDENTIFIER_LENGTH (DECL_NAME (field))((tree_check ((((contains_struct_check ((field), (TS_DECL_MINIMAL ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1268, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1268, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.len )) |
1269 | if (IDENTIFIER_POINTER (DECL_NAME (field))((const char *) (tree_check ((((contains_struct_check ((field ), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1269, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1269, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str )[len - 1] == ' ') |
1270 | continue; |
1271 | |
1272 | m_candidates.safe_push (DECL_NAME (field)((contains_struct_check ((field), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1272, __FUNCTION__))->decl_minimal.name)); |
1273 | } |
1274 | } |
1275 | |
1276 | |
1277 | /* Helper function for lookup_member_fuzzy, called via dfs_walk_all |
1278 | DATA is really a lookup_field_fuzzy_info. Look for a field with |
1279 | the name indicated there in BINFO. Gathers pertinent identifiers into |
1280 | m_candidates. */ |
1281 | |
1282 | static tree |
1283 | lookup_field_fuzzy_r (tree binfo, void *data) |
1284 | { |
1285 | lookup_field_fuzzy_info *lffi = (lookup_field_fuzzy_info *) data; |
1286 | tree type = BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1286, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1286, __FUNCTION__))->typed.type); |
1287 | |
1288 | lffi->fuzzy_lookup_field (type); |
1289 | |
1290 | return NULL_TREE(tree) __null; |
1291 | } |
1292 | |
1293 | /* Like lookup_member, but try to find the closest match for NAME, |
1294 | rather than an exact match, and return an identifier (or NULL_TREE). |
1295 | Do not complain. */ |
1296 | |
1297 | tree |
1298 | lookup_member_fuzzy (tree xbasetype, tree name, bool want_type_p) |
1299 | { |
1300 | tree type = NULL_TREE(tree) __null, basetype_path = NULL_TREE(tree) __null; |
1301 | class lookup_field_fuzzy_info lffi (want_type_p); |
1302 | |
1303 | /* rval_binfo is the binfo associated with the found member, note, |
1304 | this can be set with useful information, even when rval is not |
1305 | set, because it must deal with ALL members, not just non-function |
1306 | members. It is used for ambiguity checking and the hidden |
1307 | checks. Whereas rval is only set if a proper (not hidden) |
1308 | non-function member is found. */ |
1309 | |
1310 | if (name == error_mark_nodeglobal_trees[TI_ERROR_MARK] |
1311 | || xbasetype == NULL_TREE(tree) __null |
1312 | || xbasetype == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
1313 | return NULL_TREE(tree) __null; |
1314 | |
1315 | gcc_assert (identifier_p (name))((void)(!(identifier_p (name)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1315, __FUNCTION__), 0 : 0)); |
1316 | |
1317 | if (TREE_CODE (xbasetype)((enum tree_code) (xbasetype)->base.code) == TREE_BINFO) |
1318 | { |
1319 | type = BINFO_TYPE (xbasetype)((contains_struct_check (((tree_check ((xbasetype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1319, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1319, __FUNCTION__))->typed.type); |
1320 | basetype_path = xbasetype; |
1321 | } |
1322 | else |
1323 | { |
1324 | if (!RECORD_OR_UNION_CODE_P (TREE_CODE (xbasetype))((((enum tree_code) (xbasetype)->base.code)) == RECORD_TYPE || (((enum tree_code) (xbasetype)->base.code)) == UNION_TYPE )) |
1325 | return NULL_TREE(tree) __null; |
1326 | type = xbasetype; |
1327 | xbasetype = NULL_TREE(tree) __null; |
1328 | } |
1329 | |
1330 | type = complete_type (type); |
1331 | |
1332 | /* Make sure we're looking for a member of the current instantiation in the |
1333 | right partial specialization. */ |
1334 | if (flag_conceptsglobal_options.x_flag_concepts && dependent_type_p (type)) |
1335 | type = currently_open_class (type); |
1336 | |
1337 | if (!basetype_path) |
1338 | basetype_path = TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1338, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval); |
1339 | |
1340 | if (!basetype_path) |
1341 | return NULL_TREE(tree) __null; |
1342 | |
1343 | /* Populate lffi.m_candidates. */ |
1344 | dfs_walk_all (basetype_path, &lookup_field_fuzzy_r, NULL__null, &lffi); |
1345 | |
1346 | return find_closest_identifier (name, &lffi.m_candidates); |
1347 | } |
1348 | |
1349 | /* Like lookup_member, except that if we find a function member we |
1350 | return NULL_TREE. */ |
1351 | |
1352 | tree |
1353 | lookup_field (tree xbasetype, tree name, int protect, bool want_type) |
1354 | { |
1355 | tree rval = lookup_member (xbasetype, name, protect, want_type, |
1356 | tf_warning_or_error); |
1357 | |
1358 | /* Ignore functions, but propagate the ambiguity list. */ |
1359 | if (!error_operand_p (rval) |
1360 | && (rval && BASELINK_P (rval)(((enum tree_code) (rval)->base.code) == BASELINK))) |
1361 | return NULL_TREE(tree) __null; |
1362 | |
1363 | return rval; |
1364 | } |
1365 | |
1366 | /* Like lookup_member, except that if we find a non-function member we |
1367 | return NULL_TREE. */ |
1368 | |
1369 | tree |
1370 | lookup_fnfields (tree xbasetype, tree name, int protect, |
1371 | tsubst_flags_t complain) |
1372 | { |
1373 | tree rval = lookup_member (xbasetype, name, protect, /*want_type=*/false, |
1374 | complain); |
1375 | |
1376 | /* Ignore non-functions, but propagate the ambiguity list. */ |
1377 | if (!error_operand_p (rval) |
1378 | && (rval && !BASELINK_P (rval)(((enum tree_code) (rval)->base.code) == BASELINK))) |
1379 | return NULL_TREE(tree) __null; |
1380 | |
1381 | return rval; |
1382 | } |
1383 | |
1384 | /* DECL is the result of a qualified name lookup. QUALIFYING_SCOPE is |
1385 | the class or namespace used to qualify the name. CONTEXT_CLASS is |
1386 | the class corresponding to the object in which DECL will be used. |
1387 | Return a possibly modified version of DECL that takes into account |
1388 | the CONTEXT_CLASS. |
1389 | |
1390 | In particular, consider an expression like `B::m' in the context of |
1391 | a derived class `D'. If `B::m' has been resolved to a BASELINK, |
1392 | then the most derived class indicated by the BASELINK_BINFO will be |
1393 | `B', not `D'. This function makes that adjustment. */ |
1394 | |
1395 | tree |
1396 | adjust_result_of_qualified_name_lookup (tree decl, |
1397 | tree qualifying_scope, |
1398 | tree context_class) |
1399 | { |
1400 | if (context_class && context_class != error_mark_nodeglobal_trees[TI_ERROR_MARK] |
1401 | && CLASS_TYPE_P (context_class)(((((enum tree_code) (context_class)->base.code)) == RECORD_TYPE || (((enum tree_code) (context_class)->base.code)) == UNION_TYPE ) && ((tree_class_check ((context_class), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1401, __FUNCTION__))->type_common.lang_flag_5)) |
1402 | && CLASS_TYPE_P (qualifying_scope)(((((enum tree_code) (qualifying_scope)->base.code)) == RECORD_TYPE || (((enum tree_code) (qualifying_scope)->base.code)) == UNION_TYPE ) && ((tree_class_check ((qualifying_scope), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1402, __FUNCTION__))->type_common.lang_flag_5)) |
1403 | && DERIVED_FROM_P (qualifying_scope, context_class)(lookup_base ((context_class), (qualifying_scope), ba_any, __null , tf_none) != (tree) __null) |
1404 | && BASELINK_P (decl)(((enum tree_code) (decl)->base.code) == BASELINK)) |
1405 | { |
1406 | tree base; |
1407 | |
1408 | /* Look for the QUALIFYING_SCOPE as a base of the CONTEXT_CLASS. |
1409 | Because we do not yet know which function will be chosen by |
1410 | overload resolution, we cannot yet check either accessibility |
1411 | or ambiguity -- in either case, the choice of a static member |
1412 | function might make the usage valid. */ |
1413 | base = lookup_base (context_class, qualifying_scope, |
1414 | ba_unique, NULL__null, tf_none); |
1415 | if (base && base != error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
1416 | { |
1417 | BASELINK_ACCESS_BINFO (decl)(((struct tree_baselink*) (tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1417, __FUNCTION__, (BASELINK))))->access_binfo) = base; |
1418 | tree decl_binfo |
1419 | = lookup_base (base, BINFO_TYPE (BASELINK_BINFO (decl))((contains_struct_check (((tree_check (((((struct tree_baselink *) (tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1419, __FUNCTION__, (BASELINK))))->binfo)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1419, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1419, __FUNCTION__))->typed.type), |
1420 | ba_unique, NULL__null, tf_none); |
1421 | if (decl_binfo && decl_binfo != error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
1422 | BASELINK_BINFO (decl)(((struct tree_baselink*) (tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1422, __FUNCTION__, (BASELINK))))->binfo) = decl_binfo; |
1423 | } |
1424 | } |
1425 | |
1426 | if (BASELINK_P (decl)(((enum tree_code) (decl)->base.code) == BASELINK)) |
1427 | BASELINK_QUALIFIED_P (decl)((tree_not_check2 (((tree_check ((decl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1427, __FUNCTION__, (BASELINK)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1427, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0) = true; |
1428 | |
1429 | return decl; |
1430 | } |
1431 | |
1432 | |
1433 | /* Walk the class hierarchy within BINFO, in a depth-first traversal. |
1434 | PRE_FN is called in preorder, while POST_FN is called in postorder. |
1435 | If PRE_FN returns DFS_SKIP_BASES, child binfos will not be |
1436 | walked. If PRE_FN or POST_FN returns a different non-NULL value, |
1437 | that value is immediately returned and the walk is terminated. One |
1438 | of PRE_FN and POST_FN can be NULL. At each node, PRE_FN and |
1439 | POST_FN are passed the binfo to examine and the caller's DATA |
1440 | value. All paths are walked, thus virtual and morally virtual |
1441 | binfos can be multiply walked. */ |
1442 | |
1443 | tree |
1444 | dfs_walk_all (tree binfo, tree (*pre_fn) (tree, void *), |
1445 | tree (*post_fn) (tree, void *), void *data) |
1446 | { |
1447 | tree rval; |
1448 | unsigned ix; |
1449 | tree base_binfo; |
1450 | |
1451 | /* Call the pre-order walking function. */ |
1452 | if (pre_fn) |
1453 | { |
1454 | rval = pre_fn (binfo, data); |
1455 | if (rval) |
1456 | { |
1457 | if (rval == dfs_skip_bases((tree)1)) |
1458 | goto skip_bases; |
1459 | return rval; |
1460 | } |
1461 | } |
1462 | |
1463 | /* Find the next child binfo to walk. */ |
1464 | for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo)((&(tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1464, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)-> iterate ((ix), &(base_binfo))); ix++) |
1465 | { |
1466 | rval = dfs_walk_all (base_binfo, pre_fn, post_fn, data); |
1467 | if (rval) |
1468 | return rval; |
1469 | } |
1470 | |
1471 | skip_bases: |
1472 | /* Call the post-order walking function. */ |
1473 | if (post_fn) |
1474 | { |
1475 | rval = post_fn (binfo, data); |
1476 | gcc_assert (rval != dfs_skip_bases)((void)(!(rval != ((tree)1)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1476, __FUNCTION__), 0 : 0)); |
1477 | return rval; |
1478 | } |
1479 | |
1480 | return NULL_TREE(tree) __null; |
1481 | } |
1482 | |
1483 | /* Worker for dfs_walk_once. This behaves as dfs_walk_all, except |
1484 | that binfos are walked at most once. */ |
1485 | |
1486 | static tree |
1487 | dfs_walk_once_r (tree binfo, tree (*pre_fn) (tree, void *), |
1488 | tree (*post_fn) (tree, void *), hash_set<tree> *pset, |
1489 | void *data) |
1490 | { |
1491 | tree rval; |
1492 | unsigned ix; |
1493 | tree base_binfo; |
1494 | |
1495 | /* Call the pre-order walking function. */ |
1496 | if (pre_fn) |
1497 | { |
1498 | rval = pre_fn (binfo, data); |
1499 | if (rval) |
1500 | { |
1501 | if (rval == dfs_skip_bases((tree)1)) |
1502 | goto skip_bases; |
1503 | |
1504 | return rval; |
1505 | } |
1506 | } |
1507 | |
1508 | /* Find the next child binfo to walk. */ |
1509 | for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo)((&(tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1509, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)-> iterate ((ix), &(base_binfo))); ix++) |
1510 | { |
1511 | if (BINFO_VIRTUAL_P (base_binfo)((tree_check ((base_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1511, __FUNCTION__, (TREE_BINFO)))->base.static_flag)) |
1512 | if (pset->add (base_binfo)) |
1513 | continue; |
1514 | |
1515 | rval = dfs_walk_once_r (base_binfo, pre_fn, post_fn, pset, data); |
1516 | if (rval) |
1517 | return rval; |
1518 | } |
1519 | |
1520 | skip_bases: |
1521 | /* Call the post-order walking function. */ |
1522 | if (post_fn) |
1523 | { |
1524 | rval = post_fn (binfo, data); |
1525 | gcc_assert (rval != dfs_skip_bases)((void)(!(rval != ((tree)1)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1525, __FUNCTION__), 0 : 0)); |
1526 | return rval; |
1527 | } |
1528 | |
1529 | return NULL_TREE(tree) __null; |
1530 | } |
1531 | |
1532 | /* Like dfs_walk_all, except that binfos are not multiply walked. For |
1533 | non-diamond shaped hierarchies this is the same as dfs_walk_all. |
1534 | For diamond shaped hierarchies we must mark the virtual bases, to |
1535 | avoid multiple walks. */ |
1536 | |
1537 | tree |
1538 | dfs_walk_once (tree binfo, tree (*pre_fn) (tree, void *), |
1539 | tree (*post_fn) (tree, void *), void *data) |
1540 | { |
1541 | static int active = 0; /* We must not be called recursively. */ |
1542 | tree rval; |
1543 | |
1544 | gcc_assert (pre_fn || post_fn)((void)(!(pre_fn || post_fn) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1544, __FUNCTION__), 0 : 0)); |
1545 | gcc_assert (!active)((void)(!(!active) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1545, __FUNCTION__), 0 : 0)); |
1546 | active++; |
1547 | |
1548 | if (!CLASSTYPE_DIAMOND_SHAPED_P (BINFO_TYPE (binfo))((((tree_class_check ((((contains_struct_check (((tree_check ( (binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1548, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1548, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1548, __FUNCTION__))->type_with_lang_specific.lang_specific ))->diamond_shaped)) |
1549 | /* We are not diamond shaped, and therefore cannot encounter the |
1550 | same binfo twice. */ |
1551 | rval = dfs_walk_all (binfo, pre_fn, post_fn, data); |
1552 | else |
1553 | { |
1554 | hash_set<tree> pset; |
1555 | rval = dfs_walk_once_r (binfo, pre_fn, post_fn, &pset, data); |
1556 | } |
1557 | |
1558 | active--; |
1559 | |
1560 | return rval; |
1561 | } |
1562 | |
1563 | /* Worker function for dfs_walk_once_accessible. Behaves like |
1564 | dfs_walk_once_r, except (a) FRIENDS_P is true if special |
1565 | access given by the current context should be considered, (b) ONCE |
1566 | indicates whether bases should be marked during traversal. */ |
1567 | |
1568 | static tree |
1569 | dfs_walk_once_accessible_r (tree binfo, bool friends_p, hash_set<tree> *pset, |
1570 | tree (*pre_fn) (tree, void *), |
1571 | tree (*post_fn) (tree, void *), void *data) |
1572 | { |
1573 | tree rval = NULL_TREE(tree) __null; |
1574 | unsigned ix; |
1575 | tree base_binfo; |
1576 | |
1577 | /* Call the pre-order walking function. */ |
1578 | if (pre_fn) |
1579 | { |
1580 | rval = pre_fn (binfo, data); |
1581 | if (rval) |
1582 | { |
1583 | if (rval == dfs_skip_bases((tree)1)) |
1584 | goto skip_bases; |
1585 | |
1586 | return rval; |
1587 | } |
1588 | } |
1589 | |
1590 | /* Find the next child binfo to walk. */ |
1591 | for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo)((&(tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1591, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)-> iterate ((ix), &(base_binfo))); ix++) |
1592 | { |
1593 | bool mark = pset && BINFO_VIRTUAL_P (base_binfo)((tree_check ((base_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1593, __FUNCTION__, (TREE_BINFO)))->base.static_flag); |
1594 | |
1595 | if (mark && pset->contains (base_binfo)) |
1596 | continue; |
1597 | |
1598 | /* If the base is inherited via private or protected |
1599 | inheritance, then we can't see it, unless we are a friend of |
1600 | the current binfo. */ |
1601 | if (BINFO_BASE_ACCESS (binfo, ix)(*((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1601, __FUNCTION__, (TREE_BINFO)))->binfo.base_accesses) )[(ix)] != access_public_nodeglobal_trees[TI_PUBLIC]) |
1602 | { |
1603 | tree scope; |
1604 | if (!friends_p) |
1605 | continue; |
1606 | scope = current_scope (); |
1607 | if (!scope |
1608 | || TREE_CODE (scope)((enum tree_code) (scope)->base.code) == NAMESPACE_DECL |
1609 | || !is_friend (BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1609, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1609, __FUNCTION__))->typed.type), scope)) |
1610 | continue; |
1611 | } |
1612 | |
1613 | if (mark) |
1614 | pset->add (base_binfo); |
1615 | |
1616 | rval = dfs_walk_once_accessible_r (base_binfo, friends_p, pset, |
1617 | pre_fn, post_fn, data); |
1618 | if (rval) |
1619 | return rval; |
1620 | } |
1621 | |
1622 | skip_bases: |
1623 | /* Call the post-order walking function. */ |
1624 | if (post_fn) |
1625 | { |
1626 | rval = post_fn (binfo, data); |
1627 | gcc_assert (rval != dfs_skip_bases)((void)(!(rval != ((tree)1)) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1627, __FUNCTION__), 0 : 0)); |
1628 | return rval; |
1629 | } |
1630 | |
1631 | return NULL_TREE(tree) __null; |
1632 | } |
1633 | |
1634 | /* Like dfs_walk_once except that only accessible bases are walked. |
1635 | FRIENDS_P indicates whether friendship of the local context |
1636 | should be considered when determining accessibility. */ |
1637 | |
1638 | static tree |
1639 | dfs_walk_once_accessible (tree binfo, bool friends_p, |
1640 | tree (*pre_fn) (tree, void *), |
1641 | tree (*post_fn) (tree, void *), void *data) |
1642 | { |
1643 | hash_set<tree> *pset = NULL__null; |
1644 | if (CLASSTYPE_DIAMOND_SHAPED_P (BINFO_TYPE (binfo))((((tree_class_check ((((contains_struct_check (((tree_check ( (binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1644, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1644, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1644, __FUNCTION__))->type_with_lang_specific.lang_specific ))->diamond_shaped)) |
1645 | pset = new hash_set<tree>; |
1646 | tree rval = dfs_walk_once_accessible_r (binfo, friends_p, pset, |
1647 | pre_fn, post_fn, data); |
1648 | |
1649 | if (pset) |
1650 | delete pset; |
1651 | return rval; |
1652 | } |
1653 | |
1654 | /* Return true iff the code of T is CODE, and it has compatible |
1655 | type with TYPE. */ |
1656 | |
1657 | static bool |
1658 | matches_code_and_type_p (tree t, enum tree_code code, tree type) |
1659 | { |
1660 | if (TREE_CODE (t)((enum tree_code) (t)->base.code) != code) |
1661 | return false; |
1662 | if (!cxx_types_compatible_p (TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1662, __FUNCTION__))->typed.type), type)) |
1663 | return false; |
1664 | return true; |
1665 | } |
1666 | |
1667 | /* Subroutine of direct_accessor_p and reference_accessor_p. |
1668 | Determine if COMPONENT_REF is a simple field lookup of this->FIELD_DECL. |
1669 | We expect a tree of the form: |
1670 | <component_ref: |
1671 | <indirect_ref:S> |
1672 | <nop_expr:P* |
1673 | <parm_decl (this)> |
1674 | <field_decl (FIELD_DECL)>>>. */ |
1675 | |
1676 | static bool |
1677 | field_access_p (tree component_ref, tree field_decl, tree field_type) |
1678 | { |
1679 | if (!matches_code_and_type_p (component_ref, COMPONENT_REF, field_type)) |
1680 | return false; |
1681 | |
1682 | tree indirect_ref = TREE_OPERAND (component_ref, 0)(*((const_cast<tree*> (tree_operand_check ((component_ref ), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1682, __FUNCTION__))))); |
1683 | if (!INDIRECT_REF_P (indirect_ref)(((enum tree_code) (indirect_ref)->base.code) == INDIRECT_REF )) |
1684 | return false; |
1685 | |
1686 | tree ptr = STRIP_NOPS (TREE_OPERAND (indirect_ref, 0))((*((const_cast<tree*> (tree_operand_check ((indirect_ref ), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1686, __FUNCTION__)))))) = tree_strip_nop_conversions ((const_cast <union tree_node *> ((((*((const_cast<tree*> (tree_operand_check ((indirect_ref), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1686, __FUNCTION__)))))))))); |
1687 | if (!is_this_parameter (ptr)) |
1688 | return false; |
1689 | |
1690 | /* Must access the correct field. */ |
1691 | if (TREE_OPERAND (component_ref, 1)(*((const_cast<tree*> (tree_operand_check ((component_ref ), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1691, __FUNCTION__))))) != field_decl) |
1692 | return false; |
1693 | return true; |
1694 | } |
1695 | |
1696 | /* Subroutine of field_accessor_p. |
1697 | |
1698 | Assuming that INIT_EXPR has already had its code and type checked, |
1699 | determine if it is a simple accessor for FIELD_DECL |
1700 | (of type FIELD_TYPE). |
1701 | |
1702 | Specifically, a simple accessor within struct S of the form: |
1703 | T get_field () { return m_field; } |
1704 | should have a constexpr_fn_retval (saved_tree) of the form: |
1705 | <init_expr:T |
1706 | <result_decl:T |
1707 | <nop_expr:T |
1708 | <component_ref: |
1709 | <indirect_ref:S> |
1710 | <nop_expr:P* |
1711 | <parm_decl (this)> |
1712 | <field_decl (FIELD_DECL)>>>>>. */ |
1713 | |
1714 | static bool |
1715 | direct_accessor_p (tree init_expr, tree field_decl, tree field_type) |
1716 | { |
1717 | tree result_decl = TREE_OPERAND (init_expr, 0)(*((const_cast<tree*> (tree_operand_check ((init_expr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1717, __FUNCTION__))))); |
1718 | if (!matches_code_and_type_p (result_decl, RESULT_DECL, field_type)) |
1719 | return false; |
1720 | |
1721 | tree component_ref = STRIP_NOPS (TREE_OPERAND (init_expr, 1))((*((const_cast<tree*> (tree_operand_check ((init_expr) , (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1721, __FUNCTION__)))))) = tree_strip_nop_conversions ((const_cast <union tree_node *> ((((*((const_cast<tree*> (tree_operand_check ((init_expr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1721, __FUNCTION__)))))))))); |
1722 | if (!field_access_p (component_ref, field_decl, field_type)) |
1723 | return false; |
1724 | |
1725 | return true; |
1726 | } |
1727 | |
1728 | /* Subroutine of field_accessor_p. |
1729 | |
1730 | Assuming that INIT_EXPR has already had its code and type checked, |
1731 | determine if it is a "reference" accessor for FIELD_DECL |
1732 | (of type FIELD_REFERENCE_TYPE). |
1733 | |
1734 | Specifically, a simple accessor within struct S of the form: |
1735 | T& get_field () { return m_field; } |
1736 | should have a constexpr_fn_retval (saved_tree) of the form: |
1737 | <init_expr:T& |
1738 | <result_decl:T& |
1739 | <nop_expr: T& |
1740 | <addr_expr: T* |
1741 | <component_ref:T |
1742 | <indirect_ref:S |
1743 | <nop_expr |
1744 | <parm_decl (this)>> |
1745 | <field (FIELD_DECL)>>>>>>. */ |
1746 | static bool |
1747 | reference_accessor_p (tree init_expr, tree field_decl, tree field_type, |
1748 | tree field_reference_type) |
1749 | { |
1750 | tree result_decl = TREE_OPERAND (init_expr, 0)(*((const_cast<tree*> (tree_operand_check ((init_expr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1750, __FUNCTION__))))); |
1751 | if (!matches_code_and_type_p (result_decl, RESULT_DECL, field_reference_type)) |
1752 | return false; |
1753 | |
1754 | tree field_pointer_type = build_pointer_type (field_type); |
1755 | tree addr_expr = STRIP_NOPS (TREE_OPERAND (init_expr, 1))((*((const_cast<tree*> (tree_operand_check ((init_expr) , (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1755, __FUNCTION__)))))) = tree_strip_nop_conversions ((const_cast <union tree_node *> ((((*((const_cast<tree*> (tree_operand_check ((init_expr), (1), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1755, __FUNCTION__)))))))))); |
1756 | if (!matches_code_and_type_p (addr_expr, ADDR_EXPR, field_pointer_type)) |
1757 | return false; |
1758 | |
1759 | tree component_ref = STRIP_NOPS (TREE_OPERAND (addr_expr, 0))((*((const_cast<tree*> (tree_operand_check ((addr_expr) , (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1759, __FUNCTION__)))))) = tree_strip_nop_conversions ((const_cast <union tree_node *> ((((*((const_cast<tree*> (tree_operand_check ((addr_expr), (0), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1759, __FUNCTION__)))))))))); |
1760 | |
1761 | if (!field_access_p (component_ref, field_decl, field_type)) |
1762 | return false; |
1763 | |
1764 | return true; |
1765 | } |
1766 | |
1767 | /* Return true if FN is an accessor method for FIELD_DECL. |
1768 | i.e. a method of the form { return FIELD; }, with no |
1769 | conversions. |
1770 | |
1771 | If CONST_P, then additionally require that FN be a const |
1772 | method. */ |
1773 | |
1774 | static bool |
1775 | field_accessor_p (tree fn, tree field_decl, bool const_p) |
1776 | { |
1777 | if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) != FUNCTION_DECL) |
1778 | return false; |
1779 | |
1780 | /* We don't yet support looking up static data, just fields. */ |
1781 | if (TREE_CODE (field_decl)((enum tree_code) (field_decl)->base.code) != FIELD_DECL) |
1782 | return false; |
1783 | |
1784 | tree fntype = TREE_TYPE (fn)((contains_struct_check ((fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1784, __FUNCTION__))->typed.type); |
1785 | if (TREE_CODE (fntype)((enum tree_code) (fntype)->base.code) != METHOD_TYPE) |
1786 | return false; |
1787 | |
1788 | /* If the field is accessed via a const "this" argument, verify |
1789 | that the "this" parameter is const. */ |
1790 | if (const_p) |
1791 | { |
1792 | tree this_class = class_of_this_parm (fntype); |
1793 | if (!TYPE_READONLY (this_class)((tree_class_check ((this_class), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1793, __FUNCTION__))->base.readonly_flag)) |
1794 | return false; |
1795 | } |
1796 | |
1797 | tree saved_tree = DECL_SAVED_TREE (fn)((tree_check ((fn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1797, __FUNCTION__, (FUNCTION_DECL)))->function_decl.saved_tree ); |
1798 | |
1799 | if (saved_tree == NULL_TREE(tree) __null) |
1800 | return false; |
1801 | |
1802 | /* Attempt to extract a single return value from the function, |
1803 | if it has one. */ |
1804 | tree retval = constexpr_fn_retval (saved_tree); |
1805 | if (retval == NULL_TREE(tree) __null || retval == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
1806 | return false; |
1807 | /* Require an INIT_EXPR. */ |
1808 | if (TREE_CODE (retval)((enum tree_code) (retval)->base.code) != INIT_EXPR) |
1809 | return false; |
1810 | tree init_expr = retval; |
1811 | |
1812 | /* Determine if this is a simple accessor within struct S of the form: |
1813 | T get_field () { return m_field; }. */ |
1814 | tree field_type = TREE_TYPE (field_decl)((contains_struct_check ((field_decl), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1814, __FUNCTION__))->typed.type); |
1815 | if (cxx_types_compatible_p (TREE_TYPE (init_expr)((contains_struct_check ((init_expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1815, __FUNCTION__))->typed.type), field_type)) |
1816 | return direct_accessor_p (init_expr, field_decl, field_type); |
1817 | |
1818 | /* Failing that, determine if it is an accessor of the form: |
1819 | T& get_field () { return m_field; }. */ |
1820 | tree field_reference_type = cp_build_reference_type (field_type, false); |
1821 | if (cxx_types_compatible_p (TREE_TYPE (init_expr)((contains_struct_check ((init_expr), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1821, __FUNCTION__))->typed.type), field_reference_type)) |
1822 | return reference_accessor_p (init_expr, field_decl, field_type, |
1823 | field_reference_type); |
1824 | |
1825 | return false; |
1826 | } |
1827 | |
1828 | /* Callback data for dfs_locate_field_accessor_pre. */ |
1829 | |
1830 | class locate_field_data |
1831 | { |
1832 | public: |
1833 | locate_field_data (tree field_decl_, bool const_p_) |
1834 | : field_decl (field_decl_), const_p (const_p_) {} |
1835 | |
1836 | tree field_decl; |
1837 | bool const_p; |
1838 | }; |
1839 | |
1840 | /* Return a FUNCTION_DECL that is an "accessor" method for DATA, a FIELD_DECL, |
1841 | callable via binfo, if one exists, otherwise return NULL_TREE. |
1842 | |
1843 | Callback for dfs_walk_once_accessible for use within |
1844 | locate_field_accessor. */ |
1845 | |
1846 | static tree |
1847 | dfs_locate_field_accessor_pre (tree binfo, void *data) |
1848 | { |
1849 | locate_field_data *lfd = (locate_field_data *)data; |
1850 | tree type = BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1850, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1850, __FUNCTION__))->typed.type); |
1851 | |
1852 | vec<tree, va_gc> *member_vec; |
1853 | tree fn; |
1854 | size_t i; |
1855 | |
1856 | if (!CLASS_TYPE_P (type)(((((enum tree_code) (type)->base.code)) == RECORD_TYPE || (((enum tree_code) (type)->base.code)) == UNION_TYPE) && ((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1856, __FUNCTION__))->type_common.lang_flag_5))) |
1857 | return NULL_TREE(tree) __null; |
1858 | |
1859 | member_vec = CLASSTYPE_MEMBER_VEC (type)((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1859, __FUNCTION__))->type_with_lang_specific.lang_specific ))->members); |
1860 | if (!member_vec) |
1861 | return NULL_TREE(tree) __null; |
1862 | |
1863 | for (i = 0; vec_safe_iterate (member_vec, i, &fn); ++i) |
1864 | if (fn) |
1865 | if (field_accessor_p (fn, lfd->field_decl, lfd->const_p)) |
1866 | return fn; |
1867 | |
1868 | return NULL_TREE(tree) __null; |
1869 | } |
1870 | |
1871 | /* Return a FUNCTION_DECL that is an "accessor" method for FIELD_DECL, |
1872 | callable via BASETYPE_PATH, if one exists, otherwise return NULL_TREE. */ |
1873 | |
1874 | tree |
1875 | locate_field_accessor (tree basetype_path, tree field_decl, bool const_p) |
1876 | { |
1877 | if (TREE_CODE (basetype_path)((enum tree_code) (basetype_path)->base.code) != TREE_BINFO) |
1878 | return NULL_TREE(tree) __null; |
1879 | |
1880 | /* Walk the hierarchy, looking for a method of some base class that allows |
1881 | access to the field. */ |
1882 | locate_field_data lfd (field_decl, const_p); |
1883 | return dfs_walk_once_accessible (basetype_path, /*friends=*/true, |
1884 | dfs_locate_field_accessor_pre, |
1885 | NULL__null, &lfd); |
1886 | } |
1887 | |
1888 | /* Check throw specifier of OVERRIDER is at least as strict as |
1889 | the one of BASEFN. */ |
1890 | |
1891 | bool |
1892 | maybe_check_overriding_exception_spec (tree overrider, tree basefn) |
1893 | { |
1894 | maybe_instantiate_noexcept (basefn); |
1895 | maybe_instantiate_noexcept (overrider); |
1896 | tree base_throw = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (basefn))((tree_class_check (((tree_check2 ((((contains_struct_check ( (basefn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1896, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1896, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1896, __FUNCTION__))->type_non_common.lang_1); |
1897 | tree over_throw = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (overrider))((tree_class_check (((tree_check2 ((((contains_struct_check ( (overrider), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1897, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1897, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1897, __FUNCTION__))->type_non_common.lang_1); |
1898 | |
1899 | if (DECL_INVALID_OVERRIDER_P (overrider)(((contains_struct_check ((overrider), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1899, __FUNCTION__))->decl_common.lang_flag_4))) |
1900 | return true; |
1901 | |
1902 | /* Can't check this yet. Pretend this is fine and let |
1903 | noexcept_override_late_checks check this later. */ |
1904 | if (UNPARSED_NOEXCEPT_SPEC_P (base_throw)((base_throw) && (((tree_check ((base_throw), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1904, __FUNCTION__, (TREE_LIST)))->list.purpose)) && (((enum tree_code) (((tree_check ((base_throw), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1904, __FUNCTION__, (TREE_LIST)))->list.purpose))->base .code) == DEFERRED_PARSE)) |
1905 | || UNPARSED_NOEXCEPT_SPEC_P (over_throw)((over_throw) && (((tree_check ((over_throw), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1905, __FUNCTION__, (TREE_LIST)))->list.purpose)) && (((enum tree_code) (((tree_check ((over_throw), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1905, __FUNCTION__, (TREE_LIST)))->list.purpose))->base .code) == DEFERRED_PARSE))) |
1906 | return true; |
1907 | |
1908 | if (!comp_except_specs (base_throw, over_throw, ce_derived)) |
1909 | { |
1910 | auto_diagnostic_group d; |
1911 | error ("looser exception specification on overriding virtual function " |
1912 | "%q+#F", overrider); |
1913 | inform (DECL_SOURCE_LOCATION (basefn)((contains_struct_check ((basefn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1913, __FUNCTION__))->decl_minimal.locus), |
1914 | "overridden function is %q#F", basefn); |
1915 | DECL_INVALID_OVERRIDER_P (overrider)(((contains_struct_check ((overrider), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1915, __FUNCTION__))->decl_common.lang_flag_4)) = 1; |
1916 | return false; |
1917 | } |
1918 | return true; |
1919 | } |
1920 | |
1921 | /* Check that virtual overrider OVERRIDER is acceptable for base function |
1922 | BASEFN. Issue diagnostic, and return zero, if unacceptable. */ |
1923 | |
1924 | static int |
1925 | check_final_overrider (tree overrider, tree basefn) |
1926 | { |
1927 | tree over_type = TREE_TYPE (overrider)((contains_struct_check ((overrider), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1927, __FUNCTION__))->typed.type); |
1928 | tree base_type = TREE_TYPE (basefn)((contains_struct_check ((basefn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1928, __FUNCTION__))->typed.type); |
1929 | tree over_return = fndecl_declared_return_type (overrider); |
1930 | tree base_return = fndecl_declared_return_type (basefn); |
1931 | |
1932 | int fail = 0; |
1933 | |
1934 | if (DECL_INVALID_OVERRIDER_P (overrider)(((contains_struct_check ((overrider), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1934, __FUNCTION__))->decl_common.lang_flag_4))) |
1935 | return 0; |
1936 | |
1937 | if (same_type_p (base_return, over_return)comptypes ((base_return), (over_return), 0)) |
1938 | /* OK */; |
1939 | else if ((CLASS_TYPE_P (over_return)(((((enum tree_code) (over_return)->base.code)) == RECORD_TYPE || (((enum tree_code) (over_return)->base.code)) == UNION_TYPE ) && ((tree_class_check ((over_return), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1939, __FUNCTION__))->type_common.lang_flag_5)) && CLASS_TYPE_P (base_return)(((((enum tree_code) (base_return)->base.code)) == RECORD_TYPE || (((enum tree_code) (base_return)->base.code)) == UNION_TYPE ) && ((tree_class_check ((base_return), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1939, __FUNCTION__))->type_common.lang_flag_5))) |
1940 | || (TREE_CODE (base_return)((enum tree_code) (base_return)->base.code) == TREE_CODE (over_return)((enum tree_code) (over_return)->base.code) |
1941 | && INDIRECT_TYPE_P (base_return)((((enum tree_code) (base_return)->base.code) == POINTER_TYPE ) || (((enum tree_code) (base_return)->base.code) == REFERENCE_TYPE )))) |
1942 | { |
1943 | /* Potentially covariant. */ |
1944 | unsigned base_quals, over_quals; |
1945 | |
1946 | fail = !INDIRECT_TYPE_P (base_return)((((enum tree_code) (base_return)->base.code) == POINTER_TYPE ) || (((enum tree_code) (base_return)->base.code) == REFERENCE_TYPE )); |
1947 | if (!fail) |
1948 | { |
1949 | if (cp_type_quals (base_return) != cp_type_quals (over_return)) |
1950 | fail = 1; |
1951 | |
1952 | if (TYPE_REF_P (base_return)(((enum tree_code) (base_return)->base.code) == REFERENCE_TYPE ) |
1953 | && (TYPE_REF_IS_RVALUE (base_return)((tree_check ((base_return), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1953, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag ) |
1954 | != TYPE_REF_IS_RVALUE (over_return)((tree_check ((over_return), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1954, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag ))) |
1955 | fail = 1; |
1956 | |
1957 | base_return = TREE_TYPE (base_return)((contains_struct_check ((base_return), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1957, __FUNCTION__))->typed.type); |
1958 | over_return = TREE_TYPE (over_return)((contains_struct_check ((over_return), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1958, __FUNCTION__))->typed.type); |
1959 | } |
1960 | base_quals = cp_type_quals (base_return); |
1961 | over_quals = cp_type_quals (over_return); |
1962 | |
1963 | if ((base_quals & over_quals) != over_quals) |
1964 | fail = 1; |
1965 | |
1966 | if (CLASS_TYPE_P (base_return)(((((enum tree_code) (base_return)->base.code)) == RECORD_TYPE || (((enum tree_code) (base_return)->base.code)) == UNION_TYPE ) && ((tree_class_check ((base_return), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1966, __FUNCTION__))->type_common.lang_flag_5)) && CLASS_TYPE_P (over_return)(((((enum tree_code) (over_return)->base.code)) == RECORD_TYPE || (((enum tree_code) (over_return)->base.code)) == UNION_TYPE ) && ((tree_class_check ((over_return), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1966, __FUNCTION__))->type_common.lang_flag_5))) |
1967 | { |
1968 | /* Strictly speaking, the standard requires the return type to be |
1969 | complete even if it only differs in cv-quals, but that seems |
1970 | like a bug in the wording. */ |
1971 | if (!same_type_ignoring_top_level_qualifiers_p (base_return, |
1972 | over_return)) |
1973 | { |
1974 | tree binfo = lookup_base (over_return, base_return, |
1975 | ba_check, NULL__null, tf_none); |
1976 | |
1977 | if (!binfo || binfo == error_mark_nodeglobal_trees[TI_ERROR_MARK]) |
1978 | fail = 1; |
1979 | } |
1980 | } |
1981 | else if (can_convert_standard (TREE_TYPE (base_type)((contains_struct_check ((base_type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1981, __FUNCTION__))->typed.type), |
1982 | TREE_TYPE (over_type)((contains_struct_check ((over_type), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1982, __FUNCTION__))->typed.type), |
1983 | tf_warning_or_error)) |
1984 | /* GNU extension, allow trivial pointer conversions such as |
1985 | converting to void *, or qualification conversion. */ |
1986 | { |
1987 | auto_diagnostic_group d; |
1988 | if (pedwarn (DECL_SOURCE_LOCATION (overrider)((contains_struct_check ((overrider), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1988, __FUNCTION__))->decl_minimal.locus), 0, |
1989 | "invalid covariant return type for %q#D", overrider)) |
1990 | inform (DECL_SOURCE_LOCATION (basefn)((contains_struct_check ((basefn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 1990, __FUNCTION__))->decl_minimal.locus), |
1991 | "overridden function is %q#D", basefn); |
1992 | } |
1993 | else |
1994 | fail = 2; |
1995 | } |
1996 | else |
1997 | fail = 2; |
1998 | if (!fail) |
1999 | /* OK */; |
2000 | else |
2001 | { |
2002 | auto_diagnostic_group d; |
2003 | if (fail == 1) |
2004 | error ("invalid covariant return type for %q+#D", overrider); |
2005 | else |
2006 | error ("conflicting return type specified for %q+#D", overrider); |
2007 | inform (DECL_SOURCE_LOCATION (basefn)((contains_struct_check ((basefn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2007, __FUNCTION__))->decl_minimal.locus), |
2008 | "overridden function is %q#D", basefn); |
2009 | DECL_INVALID_OVERRIDER_P (overrider)(((contains_struct_check ((overrider), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2009, __FUNCTION__))->decl_common.lang_flag_4)) = 1; |
2010 | return 0; |
2011 | } |
2012 | |
2013 | if (!maybe_check_overriding_exception_spec (overrider, basefn)) |
2014 | return 0; |
2015 | |
2016 | /* Check for conflicting type attributes. But leave transaction_safe for |
2017 | set_one_vmethod_tm_attributes. */ |
2018 | if (!comp_type_attributes (over_type, base_type) |
2019 | && !tx_safe_fn_type_p (base_type) |
2020 | && !tx_safe_fn_type_p (over_type)) |
2021 | { |
2022 | auto_diagnostic_group d; |
2023 | error ("conflicting type attributes specified for %q+#D", overrider); |
2024 | inform (DECL_SOURCE_LOCATION (basefn)((contains_struct_check ((basefn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2024, __FUNCTION__))->decl_minimal.locus), |
2025 | "overridden function is %q#D", basefn); |
2026 | DECL_INVALID_OVERRIDER_P (overrider)(((contains_struct_check ((overrider), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2026, __FUNCTION__))->decl_common.lang_flag_4)) = 1; |
2027 | return 0; |
2028 | } |
2029 | |
2030 | /* A consteval virtual function shall not override a virtual function that is |
2031 | not consteval. A consteval virtual function shall not be overridden by a |
2032 | virtual function that is not consteval. */ |
2033 | if (DECL_IMMEDIATE_FUNCTION_P (overrider)(((contains_struct_check (((tree_check (((((enum tree_code) ( overrider)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2033, __FUNCTION__, (TEMPLATE_DECL))))))))->result : overrider )), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2033, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2033, __FUNCTION__))->decl_common.lang_specific) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code ) (overrider)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2033, __FUNCTION__, (TEMPLATE_DECL))))))))->result : overrider )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2033, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (overrider)->base.code) == FUNCTION_DECL || (((enum tree_code) (overrider)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2033, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2033, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2033, __FUNCTION__); <->u.fn; })->immediate_fn_p : false) |
2034 | != DECL_IMMEDIATE_FUNCTION_P (basefn)(((contains_struct_check (((tree_check (((((enum tree_code) ( basefn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((basefn ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2034, __FUNCTION__, (TEMPLATE_DECL))))))))->result : basefn )), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2034, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2034, __FUNCTION__))->decl_common.lang_specific) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code ) (basefn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((basefn ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2034, __FUNCTION__, (TEMPLATE_DECL))))))))->result : basefn )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2034, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (basefn)->base.code) == FUNCTION_DECL || (((enum tree_code) (basefn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((basefn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2034, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((basefn ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2034, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2034, __FUNCTION__); <->u.fn; })->immediate_fn_p : false)) |
2035 | { |
2036 | auto_diagnostic_group d; |
2037 | if (DECL_IMMEDIATE_FUNCTION_P (overrider)(((contains_struct_check (((tree_check (((((enum tree_code) ( overrider)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2037, __FUNCTION__, (TEMPLATE_DECL))))))))->result : overrider )), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2037, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2037, __FUNCTION__))->decl_common.lang_specific) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code ) (overrider)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2037, __FUNCTION__, (TEMPLATE_DECL))))))))->result : overrider )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2037, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (overrider)->base.code) == FUNCTION_DECL || (((enum tree_code) (overrider)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2037, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2037, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2037, __FUNCTION__); <->u.fn; })->immediate_fn_p : false)) |
2038 | error ("%<consteval%> function %q+D overriding non-%<consteval%> " |
2039 | "function", overrider); |
2040 | else |
2041 | error ("non-%<consteval%> function %q+D overriding %<consteval%> " |
2042 | "function", overrider); |
2043 | inform (DECL_SOURCE_LOCATION (basefn)((contains_struct_check ((basefn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2043, __FUNCTION__))->decl_minimal.locus), |
2044 | "overridden function is %qD", basefn); |
2045 | DECL_INVALID_OVERRIDER_P (overrider)(((contains_struct_check ((overrider), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2045, __FUNCTION__))->decl_common.lang_flag_4)) = 1; |
2046 | return 0; |
2047 | } |
2048 | |
2049 | /* A function declared transaction_safe_dynamic that overrides a function |
2050 | declared transaction_safe (but not transaction_safe_dynamic) is |
2051 | ill-formed. */ |
2052 | if (tx_safe_fn_type_p (base_type) |
2053 | && lookup_attribute ("transaction_safe_dynamic", |
2054 | DECL_ATTRIBUTES (overrider)((contains_struct_check ((overrider), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2054, __FUNCTION__))->decl_common.attributes)) |
2055 | && !lookup_attribute ("transaction_safe_dynamic", |
2056 | DECL_ATTRIBUTES (basefn)((contains_struct_check ((basefn), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2056, __FUNCTION__))->decl_common.attributes))) |
2057 | { |
2058 | auto_diagnostic_group d; |
2059 | error_at (DECL_SOURCE_LOCATION (overrider)((contains_struct_check ((overrider), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2059, __FUNCTION__))->decl_minimal.locus), |
2060 | "%qD declared %<transaction_safe_dynamic%>", overrider); |
2061 | inform (DECL_SOURCE_LOCATION (basefn)((contains_struct_check ((basefn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2061, __FUNCTION__))->decl_minimal.locus), |
2062 | "overriding %qD declared %<transaction_safe%>", basefn); |
2063 | } |
2064 | |
2065 | if (DECL_DELETED_FN (basefn)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (basefn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((basefn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2065, __FUNCTION__, (TEMPLATE_DECL))))))))->result : basefn )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2065, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (basefn)->base.code) == FUNCTION_DECL || (((enum tree_code) (basefn)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((basefn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2065, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((basefn ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2065, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2065, __FUNCTION__); <->u.fn; })->min.base.threadprivate_or_deleted_p ) != DECL_DELETED_FN (overrider)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (overrider)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2065, __FUNCTION__, (TEMPLATE_DECL))))))))->result : overrider )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2065, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (overrider)->base.code) == FUNCTION_DECL || (((enum tree_code) (overrider)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2065, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2065, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2065, __FUNCTION__); <->u.fn; })->min.base.threadprivate_or_deleted_p )) |
2066 | { |
2067 | if (DECL_DELETED_FN (overrider)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (overrider)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2067, __FUNCTION__, (TEMPLATE_DECL))))))))->result : overrider )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2067, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (overrider)->base.code) == FUNCTION_DECL || (((enum tree_code) (overrider)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2067, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((overrider ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2067, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2067, __FUNCTION__); <->u.fn; })->min.base.threadprivate_or_deleted_p )) |
2068 | { |
2069 | auto_diagnostic_group d; |
2070 | error ("deleted function %q+D overriding non-deleted function", |
2071 | overrider); |
2072 | inform (DECL_SOURCE_LOCATION (basefn)((contains_struct_check ((basefn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2072, __FUNCTION__))->decl_minimal.locus), |
2073 | "overridden function is %qD", basefn); |
2074 | maybe_explain_implicit_delete (overrider); |
2075 | } |
2076 | else |
2077 | { |
2078 | auto_diagnostic_group d; |
2079 | error ("non-deleted function %q+D overriding deleted function", |
2080 | overrider); |
2081 | inform (DECL_SOURCE_LOCATION (basefn)((contains_struct_check ((basefn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2081, __FUNCTION__))->decl_minimal.locus), |
2082 | "overridden function is %qD", basefn); |
2083 | } |
2084 | return 0; |
2085 | } |
2086 | |
2087 | if (!DECL_HAS_CONTRACTS_P (basefn)((find_contract (((contains_struct_check ((basefn), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2087, __FUNCTION__))->decl_common.attributes))) != (tree ) __null) && DECL_HAS_CONTRACTS_P (overrider)((find_contract (((contains_struct_check ((overrider), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2087, __FUNCTION__))->decl_common.attributes))) != (tree ) __null)) |
2088 | { |
2089 | auto_diagnostic_group d; |
2090 | error ("function with contracts %q+D overriding contractless function", |
2091 | overrider); |
2092 | inform (DECL_SOURCE_LOCATION (basefn)((contains_struct_check ((basefn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2092, __FUNCTION__))->decl_minimal.locus), |
2093 | "overridden function is %qD", basefn); |
2094 | return 0; |
2095 | } |
2096 | else if (DECL_HAS_CONTRACTS_P (basefn)((find_contract (((contains_struct_check ((basefn), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2096, __FUNCTION__))->decl_common.attributes))) != (tree ) __null) && !DECL_HAS_CONTRACTS_P (overrider)((find_contract (((contains_struct_check ((overrider), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2096, __FUNCTION__))->decl_common.attributes))) != (tree ) __null)) |
2097 | { |
2098 | /* We're inheriting basefn's contracts; create a copy of them but |
2099 | replace references to their parms to our parms. */ |
2100 | inherit_base_contracts (overrider, basefn); |
2101 | } |
2102 | else if (DECL_HAS_CONTRACTS_P (basefn)((find_contract (((contains_struct_check ((basefn), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2102, __FUNCTION__))->decl_common.attributes))) != (tree ) __null) && DECL_HAS_CONTRACTS_P (overrider)((find_contract (((contains_struct_check ((overrider), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2102, __FUNCTION__))->decl_common.attributes))) != (tree ) __null)) |
2103 | { |
2104 | /* We're in the process of completing the overrider's class, which means |
2105 | our conditions definitely are not parsed so simply chain on the |
2106 | basefn for later checking. |
2107 | |
2108 | Note that OVERRIDER's contracts will have been fully parsed at the |
2109 | point the deferred match is run. */ |
2110 | defer_guarded_contract_match (overrider, basefn, DECL_CONTRACTS (basefn)(find_contract (((contains_struct_check ((basefn), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2110, __FUNCTION__))->decl_common.attributes)))); |
2111 | } |
2112 | |
2113 | if (DECL_FINAL_P (basefn)((tree_check ((basefn), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2113, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.final )) |
2114 | { |
2115 | auto_diagnostic_group d; |
2116 | error ("virtual function %q+D overriding final function", overrider); |
2117 | inform (DECL_SOURCE_LOCATION (basefn)((contains_struct_check ((basefn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2117, __FUNCTION__))->decl_minimal.locus), |
2118 | "overridden function is %qD", basefn); |
2119 | return 0; |
2120 | } |
2121 | return 1; |
2122 | } |
2123 | |
2124 | /* Given a class TYPE, and a function decl FNDECL, look for |
2125 | virtual functions in TYPE's hierarchy which FNDECL overrides. |
2126 | We do not look in TYPE itself, only its bases. |
2127 | |
2128 | Returns nonzero, if we find any. Set FNDECL's DECL_VIRTUAL_P, if we |
2129 | find that it overrides anything. |
2130 | |
2131 | We check that every function which is overridden, is correctly |
2132 | overridden. */ |
2133 | |
2134 | int |
2135 | look_for_overrides (tree type, tree fndecl) |
2136 | { |
2137 | tree binfo = TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2137, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval); |
2138 | tree base_binfo; |
2139 | int ix; |
2140 | int found = 0; |
2141 | |
2142 | /* A constructor for a class T does not override a function T |
2143 | in a base class. */ |
2144 | if (DECL_CONSTRUCTOR_P (fndecl)((tree_check (((((enum tree_code) (fndecl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fndecl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2144, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fndecl )), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2144, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor )) |
2145 | return 0; |
2146 | |
2147 | for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo)((&(tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2147, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)-> iterate ((ix), &(base_binfo))); ix++) |
2148 | { |
2149 | tree basetype = BINFO_TYPE (base_binfo)((contains_struct_check (((tree_check ((base_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2149, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2149, __FUNCTION__))->typed.type); |
2150 | |
2151 | if (TYPE_POLYMORPHIC_P (basetype)(((tree_not_check2 ((basetype), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2151, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_2))) |
2152 | found += look_for_overrides_r (basetype, fndecl); |
2153 | } |
2154 | return found; |
2155 | } |
2156 | |
2157 | /* Look in TYPE for virtual functions with the same signature as |
2158 | FNDECL. */ |
2159 | |
2160 | tree |
2161 | look_for_overrides_here (tree type, tree fndecl) |
2162 | { |
2163 | tree ovl = get_class_binding (type, DECL_NAME (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2163, __FUNCTION__))->decl_minimal.name)); |
2164 | |
2165 | for (ovl_iterator iter (ovl); iter; ++iter) |
2166 | { |
2167 | tree fn = *iter; |
2168 | |
2169 | if (!DECL_VIRTUAL_P (fn)((contains_struct_check ((fn), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2169, __FUNCTION__))->decl_common.virtual_flag)) |
2170 | /* Not a virtual. */; |
2171 | else if (DECL_CONTEXT (fn)((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2171, __FUNCTION__))->decl_minimal.context) != type) |
2172 | /* Introduced with a using declaration. */; |
2173 | else if (DECL_STATIC_FUNCTION_P (fndecl)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (fndecl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fndecl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2173, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fndecl )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2173, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (fndecl)->base.code) == FUNCTION_DECL || (((enum tree_code) (fndecl)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fndecl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2173, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fndecl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2173, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2173, __FUNCTION__); <->u.fn; })->static_function )) |
2174 | { |
2175 | tree btypes = TYPE_ARG_TYPES (TREE_TYPE (fn))((tree_check2 ((((contains_struct_check ((fn), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2175, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2175, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); |
2176 | tree dtypes = TYPE_ARG_TYPES (TREE_TYPE (fndecl))((tree_check2 ((((contains_struct_check ((fndecl), (TS_TYPED) , "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2176, __FUNCTION__))->typed.type)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2176, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common .values); |
2177 | if (compparms (TREE_CHAIN (btypes)((contains_struct_check ((btypes), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2177, __FUNCTION__))->common.chain), dtypes)) |
2178 | return fn; |
2179 | } |
2180 | else if (same_signature_p (fndecl, fn)) |
2181 | return fn; |
2182 | } |
2183 | |
2184 | return NULL_TREE(tree) __null; |
2185 | } |
2186 | |
2187 | /* Look in TYPE for virtual functions overridden by FNDECL. Check both |
2188 | TYPE itself and its bases. */ |
2189 | |
2190 | static int |
2191 | look_for_overrides_r (tree type, tree fndecl) |
2192 | { |
2193 | tree fn = look_for_overrides_here (type, fndecl); |
2194 | if (fn) |
2195 | { |
2196 | if (DECL_STATIC_FUNCTION_P (fndecl)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) (fndecl)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fndecl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2196, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fndecl )), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2196, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) (fndecl)->base.code) == FUNCTION_DECL || (((enum tree_code) (fndecl)->base.code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fndecl), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2196, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check ((fndecl ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2196, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2196, __FUNCTION__); <->u.fn; })->static_function )) |
2197 | { |
2198 | /* A static member function cannot match an inherited |
2199 | virtual member function. */ |
2200 | auto_diagnostic_group d; |
2201 | error ("%q+#D cannot be declared", fndecl); |
2202 | error (" since %q+#D declared in base class", fn); |
2203 | } |
2204 | else |
2205 | { |
2206 | /* It's definitely virtual, even if not explicitly set. */ |
2207 | DECL_VIRTUAL_P (fndecl)((contains_struct_check ((fndecl), (TS_DECL_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2207, __FUNCTION__))->decl_common.virtual_flag) = 1; |
2208 | check_final_overrider (fndecl, fn); |
2209 | } |
2210 | return 1; |
2211 | } |
2212 | |
2213 | /* We failed to find one declared in this class. Look in its bases. */ |
2214 | return look_for_overrides (type, fndecl); |
2215 | } |
2216 | |
2217 | /* Called via dfs_walk from dfs_get_pure_virtuals. */ |
2218 | |
2219 | static tree |
2220 | dfs_get_pure_virtuals (tree binfo, void *data) |
2221 | { |
2222 | tree type = (tree) data; |
2223 | |
2224 | /* We're not interested in primary base classes; the derived class |
2225 | of which they are a primary base will contain the information we |
2226 | need. */ |
2227 | if (!BINFO_PRIMARY_P (binfo)((tree_not_check2 (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2227, __FUNCTION__, (TREE_BINFO)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2227, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_5)) |
2228 | { |
2229 | tree virtuals; |
2230 | |
2231 | for (virtuals = BINFO_VIRTUALS (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2231, __FUNCTION__, (TREE_BINFO)))->binfo.virtuals); |
2232 | virtuals; |
2233 | virtuals = TREE_CHAIN (virtuals)((contains_struct_check ((virtuals), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2233, __FUNCTION__))->common.chain)) |
2234 | if (DECL_PURE_VIRTUAL_P (BV_FN (virtuals))(__extension__ ({ struct lang_decl *lt = ((contains_struct_check (((((enum tree_code) ((((tree_check ((virtuals), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__, (TREE_LIST)))->list.value)))->base .code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast <union tree_node *> ((((tree_check (((((tree_check ((virtuals ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__, (TREE_LIST)))->list.value))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ((( tree_check ((virtuals), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__, (TREE_LIST)))->list.value)))), (TS_DECL_COMMON ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__))->decl_common.lang_specific); if (!( ((enum tree_code) ((((tree_check ((virtuals), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__, (TREE_LIST)))->list.value)))->base .code) == FUNCTION_DECL || (((enum tree_code) ((((tree_check ( (virtuals), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__, (TREE_LIST)))->list.value)))->base .code) == TEMPLATE_DECL && ((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check (((((tree_check ((virtuals), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__, (TREE_LIST)))->list.value))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree ) __null && ((enum tree_code) (((struct tree_template_decl *)(const_cast<union tree_node *> ((((tree_check (((((tree_check ((virtuals), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__, (TREE_LIST)))->list.value))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__, (TEMPLATE_DECL))))))))->result)-> base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn ) lang_check_failed ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2234, __FUNCTION__); <->u.fn; })->pure_virtual)) |
2235 | vec_safe_push (CLASSTYPE_PURE_VIRTUALS (type)((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2235, __FUNCTION__))->type_with_lang_specific.lang_specific ))->pure_virtuals), BV_FN (virtuals)(((tree_check ((virtuals), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2235, __FUNCTION__, (TREE_LIST)))->list.value))); |
2236 | } |
2237 | |
2238 | return NULL_TREE(tree) __null; |
2239 | } |
2240 | |
2241 | /* Set CLASSTYPE_PURE_VIRTUALS for TYPE. */ |
2242 | |
2243 | void |
2244 | get_pure_virtuals (tree type) |
2245 | { |
2246 | /* Clear the CLASSTYPE_PURE_VIRTUALS list; whatever is already there |
2247 | is going to be overridden. */ |
2248 | CLASSTYPE_PURE_VIRTUALS (type)((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2248, __FUNCTION__))->type_with_lang_specific.lang_specific ))->pure_virtuals) = NULL__null; |
2249 | /* Now, run through all the bases which are not primary bases, and |
2250 | collect the pure virtual functions. We look at the vtable in |
2251 | each class to determine what pure virtual functions are present. |
2252 | (A primary base is not interesting because the derived class of |
2253 | which it is a primary base will contain vtable entries for the |
2254 | pure virtuals in the base class. */ |
2255 | dfs_walk_once (TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2255, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval), NULL__null, dfs_get_pure_virtuals, type); |
2256 | } |
2257 | |
2258 | /* Debug info for C++ classes can get very large; try to avoid |
2259 | emitting it everywhere. |
2260 | |
2261 | Note that this optimization wins even when the target supports |
2262 | BINCL (if only slightly), and reduces the amount of work for the |
2263 | linker. */ |
2264 | |
2265 | void |
2266 | maybe_suppress_debug_info (tree t) |
2267 | { |
2268 | if (write_symbolsglobal_options.x_write_symbols == NO_DEBUG(0U)) |
2269 | return; |
2270 | |
2271 | /* We might have set this earlier in cp_finish_decl. */ |
2272 | TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t))((tree_check ((((((contains_struct_check (((tree_class_check ( (((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2272, __FUNCTION__))->type_common.main_variant)), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2272, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2272, __FUNCTION__))->common.chain)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2272, __FUNCTION__, (TYPE_DECL)))->decl_common.decl_flag_1 ) = 0; |
2273 | |
2274 | /* Always emit the information for each class every time. */ |
2275 | if (flag_emit_class_debug_alwaysglobal_options.x_flag_emit_class_debug_always) |
2276 | return; |
2277 | |
2278 | /* If we already know how we're handling this class, handle debug info |
2279 | the same way. */ |
2280 | if (CLASSTYPE_INTERFACE_KNOWN (t)((((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2280, __FUNCTION__))->type_with_lang_specific.lang_specific ))->interface_unknown == 0)) |
2281 | { |
2282 | if (CLASSTYPE_INTERFACE_ONLY (t)((((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2282, __FUNCTION__))->type_with_lang_specific.lang_specific ))->interface_only)) |
2283 | TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t))((tree_check ((((((contains_struct_check (((tree_class_check ( (((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2283, __FUNCTION__))->type_common.main_variant)), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2283, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2283, __FUNCTION__))->common.chain)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2283, __FUNCTION__, (TYPE_DECL)))->decl_common.decl_flag_1 ) = 1; |
2284 | /* else don't set it. */ |
2285 | } |
2286 | /* If the class has a vtable, write out the debug info along with |
2287 | the vtable. */ |
2288 | else if (TYPE_CONTAINS_VPTR_P (t)((((tree_not_check2 ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2288, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_2)) || ((((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2288, __FUNCTION__))->type_with_lang_specific.lang_specific ))->vbases))) |
2289 | TYPE_DECL_SUPPRESS_DEBUG (TYPE_MAIN_DECL (t))((tree_check ((((((contains_struct_check (((tree_class_check ( (((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2289, __FUNCTION__))->type_common.main_variant)), (tcc_type ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2289, __FUNCTION__))), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2289, __FUNCTION__))->common.chain)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2289, __FUNCTION__, (TYPE_DECL)))->decl_common.decl_flag_1 ) = 1; |
2290 | |
2291 | /* Otherwise, just emit the debug info normally. */ |
2292 | } |
2293 | |
2294 | /* Note that we want debugging information for a base class of a class |
2295 | whose vtable is being emitted. Normally, this would happen because |
2296 | calling the constructor for a derived class implies calling the |
2297 | constructors for all bases, which involve initializing the |
2298 | appropriate vptr with the vtable for the base class; but in the |
2299 | presence of optimization, this initialization may be optimized |
2300 | away, so we tell finish_vtable_vardecl that we want the debugging |
2301 | information anyway. */ |
2302 | |
2303 | static tree |
2304 | dfs_debug_mark (tree binfo, void * /*data*/) |
2305 | { |
2306 | tree t = BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2306, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2306, __FUNCTION__))->typed.type); |
2307 | |
2308 | if (CLASSTYPE_DEBUG_REQUESTED (t)((((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2308, __FUNCTION__))->type_with_lang_specific.lang_specific ))->debug_requested)) |
2309 | return dfs_skip_bases((tree)1); |
2310 | |
2311 | CLASSTYPE_DEBUG_REQUESTED (t)((((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2311, __FUNCTION__))->type_with_lang_specific.lang_specific ))->debug_requested) = 1; |
2312 | |
2313 | return NULL_TREE(tree) __null; |
2314 | } |
2315 | |
2316 | /* Write out the debugging information for TYPE, whose vtable is being |
2317 | emitted. Also walk through our bases and note that we want to |
2318 | write out information for them. This avoids the problem of not |
2319 | writing any debug info for intermediate basetypes whose |
2320 | constructors, and thus the references to their vtables, and thus |
2321 | the vtables themselves, were optimized away. */ |
2322 | |
2323 | void |
2324 | note_debug_info_needed (tree type) |
2325 | { |
2326 | if (TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type))((tree_check ((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2326, __FUNCTION__))->type_common.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2326, __FUNCTION__, (TYPE_DECL)))->decl_common.decl_flag_1 )) |
2327 | { |
2328 | TYPE_DECL_SUPPRESS_DEBUG (TYPE_NAME (type))((tree_check ((((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2328, __FUNCTION__))->type_common.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2328, __FUNCTION__, (TYPE_DECL)))->decl_common.decl_flag_1 ) = 0; |
2329 | rest_of_type_compilation (type, namespace_bindings_p ()); |
2330 | } |
2331 | |
2332 | dfs_walk_all (TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2332, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval), dfs_debug_mark, NULL__null, 0); |
2333 | } |
2334 | |
2335 | /* Helper for lookup_conversions_r. TO_TYPE is the type converted to |
2336 | by a conversion op in base BINFO. VIRTUAL_DEPTH is nonzero if |
2337 | BINFO is morally virtual, and VIRTUALNESS is nonzero if virtual |
2338 | bases have been encountered already in the tree walk. PARENT_CONVS |
2339 | is the list of lists of conversion functions that could hide CONV |
2340 | and OTHER_CONVS is the list of lists of conversion functions that |
2341 | could hide or be hidden by CONV, should virtualness be involved in |
2342 | the hierarchy. Merely checking the conversion op's name is not |
2343 | enough because two conversion operators to the same type can have |
2344 | different names. Return nonzero if we are visible. */ |
2345 | |
2346 | static int |
2347 | check_hidden_convs (tree binfo, int virtual_depth, int virtualness, |
2348 | tree to_type, tree parent_convs, tree other_convs) |
2349 | { |
2350 | tree level, probe; |
2351 | |
2352 | /* See if we are hidden by a parent conversion. */ |
2353 | for (level = parent_convs; level; level = TREE_CHAIN (level)((contains_struct_check ((level), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2353, __FUNCTION__))->common.chain)) |
2354 | for (probe = TREE_VALUE (level)((tree_check ((level), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2354, __FUNCTION__, (TREE_LIST)))->list.value); probe; probe = TREE_CHAIN (probe)((contains_struct_check ((probe), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2354, __FUNCTION__))->common.chain)) |
2355 | if (same_type_p (to_type, TREE_TYPE (probe))comptypes ((to_type), (((contains_struct_check ((probe), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2355, __FUNCTION__))->typed.type)), 0)) |
2356 | return 0; |
2357 | |
2358 | if (virtual_depth || virtualness) |
2359 | { |
2360 | /* In a virtual hierarchy, we could be hidden, or could hide a |
2361 | conversion function on the other_convs list. */ |
2362 | for (level = other_convs; level; level = TREE_CHAIN (level)((contains_struct_check ((level), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2362, __FUNCTION__))->common.chain)) |
2363 | { |
2364 | int we_hide_them; |
2365 | int they_hide_us; |
2366 | tree *prev, other; |
2367 | |
2368 | if (!(virtual_depth || TREE_STATIC (level)((level)->base.static_flag))) |
2369 | /* Neither is morally virtual, so cannot hide each other. */ |
2370 | continue; |
2371 | |
2372 | if (!TREE_VALUE (level)((tree_check ((level), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2372, __FUNCTION__, (TREE_LIST)))->list.value)) |
2373 | /* They evaporated away already. */ |
2374 | continue; |
2375 | |
2376 | they_hide_us = (virtual_depth |
2377 | && original_binfo (binfo, TREE_PURPOSE (level)((tree_check ((level), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2377, __FUNCTION__, (TREE_LIST)))->list.purpose))); |
2378 | we_hide_them = (!they_hide_us && TREE_STATIC (level)((level)->base.static_flag) |
2379 | && original_binfo (TREE_PURPOSE (level)((tree_check ((level), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2379, __FUNCTION__, (TREE_LIST)))->list.purpose), binfo)); |
2380 | |
2381 | if (!(we_hide_them || they_hide_us)) |
2382 | /* Neither is within the other, so no hiding can occur. */ |
2383 | continue; |
2384 | |
2385 | for (prev = &TREE_VALUE (level)((tree_check ((level), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2385, __FUNCTION__, (TREE_LIST)))->list.value), other = *prev; other;) |
2386 | { |
2387 | if (same_type_p (to_type, TREE_TYPE (other))comptypes ((to_type), (((contains_struct_check ((other), (TS_TYPED ), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2387, __FUNCTION__))->typed.type)), 0)) |
2388 | { |
2389 | if (they_hide_us) |
2390 | /* We are hidden. */ |
2391 | return 0; |
2392 | |
2393 | if (we_hide_them) |
2394 | { |
2395 | /* We hide the other one. */ |
2396 | other = TREE_CHAIN (other)((contains_struct_check ((other), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2396, __FUNCTION__))->common.chain); |
2397 | *prev = other; |
2398 | continue; |
2399 | } |
2400 | } |
2401 | prev = &TREE_CHAIN (other)((contains_struct_check ((other), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2401, __FUNCTION__))->common.chain); |
2402 | other = *prev; |
2403 | } |
2404 | } |
2405 | } |
2406 | return 1; |
2407 | } |
2408 | |
2409 | /* Helper for lookup_conversions_r. PARENT_CONVS is a list of lists |
2410 | of conversion functions, the first slot will be for the current |
2411 | binfo, if MY_CONVS is non-NULL. CHILD_CONVS is the list of lists |
2412 | of conversion functions from children of the current binfo, |
2413 | concatenated with conversions from elsewhere in the hierarchy -- |
2414 | that list begins with OTHER_CONVS. Return a single list of lists |
2415 | containing only conversions from the current binfo and its |
2416 | children. */ |
2417 | |
2418 | static tree |
2419 | split_conversions (tree my_convs, tree parent_convs, |
2420 | tree child_convs, tree other_convs) |
2421 | { |
2422 | tree t; |
2423 | tree prev; |
2424 | |
2425 | /* Remove the original other_convs portion from child_convs. */ |
2426 | for (prev = NULL__null, t = child_convs; |
2427 | t != other_convs; prev = t, t = TREE_CHAIN (t)((contains_struct_check ((t), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2427, __FUNCTION__))->common.chain)) |
2428 | continue; |
2429 | |
2430 | if (prev) |
2431 | TREE_CHAIN (prev)((contains_struct_check ((prev), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2431, __FUNCTION__))->common.chain) = NULL_TREE(tree) __null; |
2432 | else |
2433 | child_convs = NULL_TREE(tree) __null; |
2434 | |
2435 | /* Attach the child convs to any we had at this level. */ |
2436 | if (my_convs) |
2437 | { |
2438 | my_convs = parent_convs; |
2439 | TREE_CHAIN (my_convs)((contains_struct_check ((my_convs), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2439, __FUNCTION__))->common.chain) = child_convs; |
2440 | } |
2441 | else |
2442 | my_convs = child_convs; |
2443 | |
2444 | return my_convs; |
2445 | } |
2446 | |
2447 | /* Worker for lookup_conversions. Lookup conversion functions in |
2448 | BINFO and its children. VIRTUAL_DEPTH is nonzero, if BINFO is in a |
2449 | morally virtual base, and VIRTUALNESS is nonzero, if we've |
2450 | encountered virtual bases already in the tree walk. PARENT_CONVS |
2451 | is a list of conversions within parent binfos. OTHER_CONVS are |
2452 | conversions found elsewhere in the tree. Return the conversions |
2453 | found within this portion of the graph in CONVS. Return nonzero if |
2454 | we encountered virtualness. We keep template and non-template |
2455 | conversions separate, to avoid unnecessary type comparisons. |
2456 | |
2457 | The located conversion functions are held in lists of lists. The |
2458 | TREE_VALUE of the outer list is the list of conversion functions |
2459 | found in a particular binfo. The TREE_PURPOSE of both the outer |
2460 | and inner lists is the binfo at which those conversions were |
2461 | found. TREE_STATIC is set for those lists within of morally |
2462 | virtual binfos. The TREE_VALUE of the inner list is the conversion |
2463 | function or overload itself. The TREE_TYPE of each inner list node |
2464 | is the converted-to type. */ |
2465 | |
2466 | static int |
2467 | lookup_conversions_r (tree binfo, int virtual_depth, int virtualness, |
2468 | tree parent_convs, tree other_convs, tree *convs) |
2469 | { |
2470 | int my_virtualness = 0; |
2471 | tree my_convs = NULL_TREE(tree) __null; |
2472 | tree child_convs = NULL_TREE(tree) __null; |
2473 | |
2474 | /* If we have no conversion operators, then don't look. */ |
2475 | if (!TYPE_HAS_CONVERSION (BINFO_TYPE (binfo))((((tree_class_check ((((contains_struct_check (((tree_check ( (binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2475, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2475, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2475, __FUNCTION__))->type_with_lang_specific.lang_specific ))->has_type_conversion)) |
2476 | { |
2477 | *convs = NULL_TREE(tree) __null; |
2478 | |
2479 | return 0; |
2480 | } |
2481 | |
2482 | if (BINFO_VIRTUAL_P (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2482, __FUNCTION__, (TREE_BINFO)))->base.static_flag)) |
2483 | virtual_depth++; |
2484 | |
2485 | /* First, locate the unhidden ones at this level. */ |
2486 | if (tree conv = get_class_binding (BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2486, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2486, __FUNCTION__))->typed.type), conv_op_identifiercp_global_trees[CPTI_CONV_OP_IDENTIFIER])) |
2487 | for (ovl_iterator iter (conv); iter; ++iter) |
2488 | { |
2489 | tree fn = *iter; |
2490 | tree type = DECL_CONV_FN_TYPE (fn)((contains_struct_check (((((void)(!(((((tree_not_check2 (((tree_check ((((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_2)) & ((tree_not_check2 (((tree_check ((((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1) & (!((tree_not_check2 (((tree_check ((((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0)))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__), 0 : 0)), ((contains_struct_check ((fn) , (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__))->decl_minimal.name))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2490, __FUNCTION__))->typed.type); |
2491 | |
2492 | if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) != TEMPLATE_DECL && type_uses_auto (type)) |
2493 | { |
2494 | mark_used (fn); |
2495 | type = DECL_CONV_FN_TYPE (fn)((contains_struct_check (((((void)(!(((((tree_not_check2 (((tree_check ((((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_2)) & ((tree_not_check2 (((tree_check ((((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_1) & (!((tree_not_check2 (((tree_check ((((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__))->decl_minimal.name)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__, (IDENTIFIER_NODE)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_0)))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__), 0 : 0)), ((contains_struct_check ((fn) , (TS_DECL_MINIMAL), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__))->decl_minimal.name))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2495, __FUNCTION__))->typed.type); |
2496 | } |
2497 | |
2498 | if (check_hidden_convs (binfo, virtual_depth, virtualness, |
2499 | type, parent_convs, other_convs)) |
2500 | { |
2501 | my_convs = tree_cons (binfo, fn, my_convs); |
2502 | TREE_TYPE (my_convs)((contains_struct_check ((my_convs), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2502, __FUNCTION__))->typed.type) = type; |
2503 | if (virtual_depth) |
2504 | { |
2505 | TREE_STATIC (my_convs)((my_convs)->base.static_flag) = 1; |
2506 | my_virtualness = 1; |
2507 | } |
2508 | } |
2509 | } |
2510 | |
2511 | if (my_convs) |
2512 | { |
2513 | parent_convs = tree_cons (binfo, my_convs, parent_convs); |
2514 | if (virtual_depth) |
2515 | TREE_STATIC (parent_convs)((parent_convs)->base.static_flag) = 1; |
2516 | } |
2517 | |
2518 | child_convs = other_convs; |
2519 | |
2520 | /* Now iterate over each base, looking for more conversions. */ |
2521 | unsigned i; |
2522 | tree base_binfo; |
2523 | for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo)((&(tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2523, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)-> iterate ((i), &(base_binfo))); i++) |
2524 | { |
2525 | tree base_convs; |
2526 | unsigned base_virtualness; |
2527 | |
2528 | base_virtualness = lookup_conversions_r (base_binfo, |
2529 | virtual_depth, virtualness, |
2530 | parent_convs, child_convs, |
2531 | &base_convs); |
2532 | if (base_virtualness) |
2533 | my_virtualness = virtualness = 1; |
2534 | child_convs = chainon (base_convs, child_convs); |
2535 | } |
2536 | |
2537 | *convs = split_conversions (my_convs, parent_convs, |
2538 | child_convs, other_convs); |
2539 | |
2540 | return my_virtualness; |
2541 | } |
2542 | |
2543 | /* Return a TREE_LIST containing all the non-hidden user-defined |
2544 | conversion functions for TYPE (and its base-classes). The |
2545 | TREE_VALUE of each node is the FUNCTION_DECL of the conversion |
2546 | function. The TREE_PURPOSE is the BINFO from which the conversion |
2547 | functions in this node were selected. This function is effectively |
2548 | performing a set of member lookups as lookup_fnfield does, but |
2549 | using the type being converted to as the unique key, rather than the |
2550 | field name. */ |
2551 | |
2552 | tree |
2553 | lookup_conversions (tree type) |
2554 | { |
2555 | tree convs; |
2556 | |
2557 | complete_type (type); |
2558 | if (!CLASS_TYPE_P (type)(((((enum tree_code) (type)->base.code)) == RECORD_TYPE || (((enum tree_code) (type)->base.code)) == UNION_TYPE) && ((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2558, __FUNCTION__))->type_common.lang_flag_5)) || !TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2558, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval)) |
2559 | return NULL_TREE(tree) __null; |
2560 | |
2561 | lookup_conversions_r (TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2561, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval), 0, 0, NULL_TREE(tree) __null, NULL_TREE(tree) __null, &convs); |
2562 | |
2563 | tree list = NULL_TREE(tree) __null; |
2564 | |
2565 | /* Flatten the list-of-lists */ |
2566 | for (; convs; convs = TREE_CHAIN (convs)((contains_struct_check ((convs), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2566, __FUNCTION__))->common.chain)) |
2567 | { |
2568 | tree probe, next; |
2569 | |
2570 | for (probe = TREE_VALUE (convs)((tree_check ((convs), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2570, __FUNCTION__, (TREE_LIST)))->list.value); probe; probe = next) |
2571 | { |
2572 | next = TREE_CHAIN (probe)((contains_struct_check ((probe), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2572, __FUNCTION__))->common.chain); |
2573 | |
2574 | TREE_CHAIN (probe)((contains_struct_check ((probe), (TS_COMMON), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2574, __FUNCTION__))->common.chain) = list; |
2575 | list = probe; |
2576 | } |
2577 | } |
2578 | |
2579 | return list; |
2580 | } |
2581 | |
2582 | /* Returns the binfo of the first direct or indirect virtual base derived |
2583 | from BINFO, or NULL if binfo is not via virtual. */ |
2584 | |
2585 | tree |
2586 | binfo_from_vbase (tree binfo) |
2587 | { |
2588 | for (; binfo; binfo = BINFO_INHERITANCE_CHAIN (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2588, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance)) |
2589 | { |
2590 | if (BINFO_VIRTUAL_P (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2590, __FUNCTION__, (TREE_BINFO)))->base.static_flag)) |
2591 | return binfo; |
2592 | } |
2593 | return NULL_TREE(tree) __null; |
2594 | } |
2595 | |
2596 | /* Returns the binfo of the first direct or indirect virtual base derived |
2597 | from BINFO up to the TREE_TYPE, LIMIT, or NULL if binfo is not |
2598 | via virtual. */ |
2599 | |
2600 | tree |
2601 | binfo_via_virtual (tree binfo, tree limit) |
2602 | { |
2603 | if (limit && !CLASSTYPE_VBASECLASSES (limit)((((tree_class_check ((limit), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2603, __FUNCTION__))->type_with_lang_specific.lang_specific ))->vbases)) |
2604 | /* LIMIT has no virtual bases, so BINFO cannot be via one. */ |
2605 | return NULL_TREE(tree) __null; |
2606 | |
2607 | for (; binfo && !SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), limit)((((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2607, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2607, __FUNCTION__))->typed.type)) == (limit)); |
2608 | binfo = BINFO_INHERITANCE_CHAIN (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2608, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance)) |
2609 | { |
2610 | if (BINFO_VIRTUAL_P (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2610, __FUNCTION__, (TREE_BINFO)))->base.static_flag)) |
2611 | return binfo; |
2612 | } |
2613 | return NULL_TREE(tree) __null; |
2614 | } |
2615 | |
2616 | /* BINFO is for a base class in some hierarchy. Return true iff it is a |
2617 | direct base. */ |
2618 | |
2619 | bool |
2620 | binfo_direct_p (tree binfo) |
2621 | { |
2622 | tree d_binfo = BINFO_INHERITANCE_CHAIN (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2622, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance); |
2623 | if (BINFO_INHERITANCE_CHAIN (d_binfo)((tree_check ((d_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2623, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance)) |
2624 | /* A second inheritance chain means indirect. */ |
2625 | return false; |
2626 | if (!BINFO_VIRTUAL_P (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2626, __FUNCTION__, (TREE_BINFO)))->base.static_flag)) |
2627 | /* Non-virtual, so only one inheritance chain means direct. */ |
2628 | return true; |
2629 | /* A virtual base looks like a direct base, so we need to look through the |
2630 | direct bases to see if it's there. */ |
2631 | tree b_binfo; |
2632 | for (int i = 0; BINFO_BASE_ITERATE (d_binfo, i, b_binfo)((&(tree_check ((d_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2632, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)-> iterate ((i), &(b_binfo))); ++i) |
2633 | if (b_binfo == binfo) |
2634 | return true; |
2635 | return false; |
2636 | } |
2637 | |
2638 | /* BINFO is a base binfo in the complete type BINFO_TYPE (HERE). |
2639 | Find the equivalent binfo within whatever graph HERE is located. |
2640 | This is the inverse of original_binfo. */ |
2641 | |
2642 | tree |
2643 | copied_binfo (tree binfo, tree here) |
2644 | { |
2645 | tree result = NULL_TREE(tree) __null; |
2646 | |
2647 | if (BINFO_VIRTUAL_P (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2647, __FUNCTION__, (TREE_BINFO)))->base.static_flag)) |
2648 | { |
2649 | tree t; |
2650 | |
2651 | for (t = here; BINFO_INHERITANCE_CHAIN (t)((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2651, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance); |
2652 | t = BINFO_INHERITANCE_CHAIN (t)((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2652, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance)) |
2653 | continue; |
2654 | |
2655 | result = binfo_for_vbase (BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2655, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2655, __FUNCTION__))->typed.type), BINFO_TYPE (t)((contains_struct_check (((tree_check ((t), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2655, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2655, __FUNCTION__))->typed.type)); |
2656 | } |
2657 | else if (BINFO_INHERITANCE_CHAIN (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2657, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance)) |
2658 | { |
2659 | tree cbinfo; |
2660 | tree base_binfo; |
2661 | int ix; |
2662 | |
2663 | cbinfo = copied_binfo (BINFO_INHERITANCE_CHAIN (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2663, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance), here); |
2664 | for (ix = 0; BINFO_BASE_ITERATE (cbinfo, ix, base_binfo)((&(tree_check ((cbinfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2664, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)-> iterate ((ix), &(base_binfo))); ix++) |
2665 | if (SAME_BINFO_TYPE_P (BINFO_TYPE (base_binfo), BINFO_TYPE (binfo))((((contains_struct_check (((tree_check ((base_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2665, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2665, __FUNCTION__))->typed.type)) == (((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2665, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2665, __FUNCTION__))->typed.type)))) |
2666 | { |
2667 | result = base_binfo; |
2668 | break; |
2669 | } |
2670 | } |
2671 | else |
2672 | { |
2673 | gcc_assert (SAME_BINFO_TYPE_P (BINFO_TYPE (here), BINFO_TYPE (binfo)))((void)(!(((((contains_struct_check (((tree_check ((here), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2673, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2673, __FUNCTION__))->typed.type)) == (((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2673, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2673, __FUNCTION__))->typed.type)))) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2673, __FUNCTION__), 0 : 0)); |
2674 | result = here; |
2675 | } |
2676 | |
2677 | gcc_assert (result)((void)(!(result) ? fancy_abort ("/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2677, __FUNCTION__), 0 : 0)); |
2678 | return result; |
2679 | } |
2680 | |
2681 | tree |
2682 | binfo_for_vbase (tree base, tree t) |
2683 | { |
2684 | unsigned ix; |
2685 | tree binfo; |
2686 | vec<tree, va_gc> *vbases; |
2687 | |
2688 | for (vbases = CLASSTYPE_VBASECLASSES (t)((((tree_class_check ((t), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2688, __FUNCTION__))->type_with_lang_specific.lang_specific ))->vbases), ix = 0; |
2689 | vec_safe_iterate (vbases, ix, &binfo); ix++) |
2690 | if (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), base)((((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2690, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2690, __FUNCTION__))->typed.type)) == (base))) |
2691 | return binfo; |
2692 | return NULL__null; |
2693 | } |
2694 | |
2695 | /* BINFO is some base binfo of HERE, within some other |
2696 | hierarchy. Return the equivalent binfo, but in the hierarchy |
2697 | dominated by HERE. This is the inverse of copied_binfo. If BINFO |
2698 | is not a base binfo of HERE, returns NULL_TREE. */ |
2699 | |
2700 | tree |
2701 | original_binfo (tree binfo, tree here) |
2702 | { |
2703 | tree result = NULL__null; |
2704 | |
2705 | if (SAME_BINFO_TYPE_P (BINFO_TYPE (binfo), BINFO_TYPE (here))((((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2705, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2705, __FUNCTION__))->typed.type)) == (((contains_struct_check (((tree_check ((here), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2705, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2705, __FUNCTION__))->typed.type)))) |
2706 | result = here; |
2707 | else if (BINFO_VIRTUAL_P (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2707, __FUNCTION__, (TREE_BINFO)))->base.static_flag)) |
2708 | result = (CLASSTYPE_VBASECLASSES (BINFO_TYPE (here))((((tree_class_check ((((contains_struct_check (((tree_check ( (here), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2708, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2708, __FUNCTION__))->typed.type)), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2708, __FUNCTION__))->type_with_lang_specific.lang_specific ))->vbases) |
2709 | ? binfo_for_vbase (BINFO_TYPE (binfo)((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2709, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2709, __FUNCTION__))->typed.type), BINFO_TYPE (here)((contains_struct_check (((tree_check ((here), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2709, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2709, __FUNCTION__))->typed.type)) |
2710 | : NULL_TREE(tree) __null); |
2711 | else if (BINFO_INHERITANCE_CHAIN (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2711, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance)) |
2712 | { |
2713 | tree base_binfos; |
2714 | |
2715 | base_binfos = original_binfo (BINFO_INHERITANCE_CHAIN (binfo)((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2715, __FUNCTION__, (TREE_BINFO)))->binfo.inheritance), here); |
2716 | if (base_binfos) |
2717 | { |
2718 | int ix; |
2719 | tree base_binfo; |
2720 | |
2721 | for (ix = 0; (base_binfo = BINFO_BASE_BINFO (base_binfos, ix)((*(&(tree_check ((base_binfos), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2721, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos))[ (ix)])); ix++) |
2722 | if (SAME_BINFO_TYPE_P (BINFO_TYPE (base_binfo),((((contains_struct_check (((tree_check ((base_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2722, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2722, __FUNCTION__))->typed.type)) == (((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2723, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2723, __FUNCTION__))->typed.type))) |
2723 | BINFO_TYPE (binfo))((((contains_struct_check (((tree_check ((base_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2722, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2722, __FUNCTION__))->typed.type)) == (((contains_struct_check (((tree_check ((binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2723, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2723, __FUNCTION__))->typed.type)))) |
2724 | { |
2725 | result = base_binfo; |
2726 | break; |
2727 | } |
2728 | } |
2729 | } |
2730 | |
2731 | return result; |
2732 | } |
2733 | |
2734 | /* True iff TYPE has any dependent bases (and therefore we can't say |
2735 | definitively that another class is not a base of an instantiation of |
2736 | TYPE). */ |
2737 | |
2738 | bool |
2739 | any_dependent_bases_p (tree type) |
2740 | { |
2741 | if (!type || !CLASS_TYPE_P (type)(((((enum tree_code) (type)->base.code)) == RECORD_TYPE || (((enum tree_code) (type)->base.code)) == UNION_TYPE) && ((tree_class_check ((type), (tcc_type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2741, __FUNCTION__))->type_common.lang_flag_5)) || !uses_template_parms (type)) |
2742 | return false; |
2743 | |
2744 | /* If we haven't set TYPE_BINFO yet, we don't know anything about the bases. |
2745 | Return false because in this situation we aren't actually looking up names |
2746 | in the scope of the class, so it doesn't matter whether it has dependent |
2747 | bases. */ |
2748 | if (!TYPE_BINFO (type)((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2748, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval)) |
2749 | return false; |
2750 | |
2751 | unsigned i; |
2752 | tree base_binfo; |
2753 | FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (type)), i, base_binfo)for (i = 0; vec_safe_iterate (((&(tree_check ((((tree_check3 ((type), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2753, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE )))->type_non_common.maxval)), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2753, __FUNCTION__, (TREE_BINFO)))->binfo.base_binfos)), (i), &(base_binfo)); ++(i)) |
2754 | if (BINFO_DEPENDENT_BASE_P (base_binfo)((tree_not_check2 (((tree_check ((base_binfo), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2754, __FUNCTION__, (TREE_BINFO)))), "/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/search.cc" , 2754, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits .lang_flag_3)) |
2755 | return true; |
2756 | |
2757 | return false; |
2758 | } |