Line data Source code
1 : /* Declarations for -*- C++ -*- name lookup routines.
2 : Copyright (C) 2003-2026 Free Software Foundation, Inc.
3 : Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>
4 :
5 : This file is part of GCC.
6 :
7 : GCC is free software; you can redistribute it and/or modify
8 : it under the terms of the GNU General Public License as published by
9 : the Free Software Foundation; either version 3, or (at your option)
10 : any later version.
11 :
12 : GCC is distributed in the hope that it will be useful,
13 : but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 : GNU General Public License for more details.
16 :
17 : You should have received a copy of the GNU General Public License
18 : along with GCC; see the file COPYING3. If not see
19 : <http://www.gnu.org/licenses/>. */
20 :
21 : #ifndef GCC_CP_NAME_LOOKUP_H
22 : #define GCC_CP_NAME_LOOKUP_H
23 :
24 : #include "c-family/c-common.h"
25 :
26 :
27 : /* The datatype used to implement C++ scope. */
28 : struct cp_binding_level;
29 :
30 : /* Nonzero if this binding is for a local scope, as opposed to a class
31 : or namespace scope. */
32 : #define LOCAL_BINDING_P(NODE) ((NODE)->is_local)
33 :
34 : /* True if NODE->value is from a base class of the class which is
35 : currently being defined. */
36 : #define INHERITED_VALUE_BINDING_P(NODE) ((NODE)->value_is_inherited)
37 :
38 : /* The IMPLICIT_TYPEDEF is hidden from ordinary name lookup (it was
39 : injected via a local class's friend decl). The typdef may be in the
40 : VALUE or the TYPE slot. We do not get the situation where the
41 : value and type slots are both filled and both hidden. */
42 : #define HIDDEN_TYPE_BINDING_P(NODE) ((NODE)->type_is_hidden)
43 :
44 : /* Create an overload suitable for recording an artificial TYPE_DECL
45 : and another decl. We use this machanism to implement the struct
46 : stat hack. */
47 :
48 : #define STAT_HACK_P(N) ((N) && TREE_CODE (N) == OVERLOAD && OVL_LOOKUP_P (N))
49 : #define STAT_TYPE_VISIBLE_P(N) TREE_USED (OVERLOAD_CHECK (N))
50 : #define STAT_TYPE(N) TREE_TYPE (N)
51 : #define STAT_DECL(N) OVL_FUNCTION (N)
52 : #define STAT_VISIBLE(N) OVL_CHAIN (N)
53 : #define MAYBE_STAT_DECL(N) (STAT_HACK_P (N) ? STAT_DECL (N) : N)
54 : #define MAYBE_STAT_TYPE(N) (STAT_HACK_P (N) ? STAT_TYPE (N) : NULL_TREE)
55 :
56 : /* When a STAT_HACK_P is true, OVL_USING_P and OVL_EXPORT_P are valid
57 : and apply to the hacked type. */
58 :
59 : /* For regular (maybe) overloaded functions, we have OVL_HIDDEN_P.
60 : But we also need to indicate hiddenness on implicit type decls
61 : (injected friend classes), and (coming soon) decls injected from
62 : block-scope externs. It is too awkward to press the existing
63 : overload marking for that. If we have a hidden non-function, we
64 : always create a STAT_HACK, and use these two markers as needed. */
65 : #define STAT_TYPE_HIDDEN_P(N) OVL_HIDDEN_P (N)
66 : #define STAT_DECL_HIDDEN_P(N) OVL_DEDUP_P (N)
67 :
68 : /* Datatype that represents binding established by a declaration between
69 : a name and a C++ entity. */
70 : struct GTY(()) cxx_binding {
71 : /* Link to chain together various bindings for this name. */
72 : cxx_binding *previous;
73 : /* The non-type entity this name is bound to. */
74 : tree value;
75 : /* The type entity this name is bound to. */
76 : tree type;
77 : /* The scope at which this binding was made. */
78 : cp_binding_level *scope;
79 :
80 : bool value_is_inherited : 1;
81 : bool is_local : 1;
82 : bool type_is_hidden : 1;
83 : };
84 :
85 : /* Datatype used to temporarily save C++ bindings (for implicit
86 : instantiations purposes and like). Implemented in decl.cc. */
87 : struct GTY(()) cxx_saved_binding {
88 : /* The name of the current binding. */
89 : tree identifier;
90 : /* The binding we're saving. */
91 : cxx_binding *binding;
92 : tree real_type_value;
93 : };
94 :
95 : /* To support lazy module loading, we squirrel away a section number
96 : (and a couple of flags) in the binding slot of unloaded bindings.
97 : We rely on pointers being aligned and setting the bottom bit to
98 : mark a lazy value. GTY doesn't like an array of union, so we have
99 : a containing struct. */
100 :
101 : struct GTY(()) binding_slot {
102 : union GTY((desc ("%1.is_lazy ()"))) binding_slot_lazy {
103 : tree GTY((tag ("false"))) binding;
104 : } u;
105 :
106 1587620 : operator tree & ()
107 : {
108 0 : gcc_checking_assert (!is_lazy ());
109 1587620 : return u.binding;
110 : }
111 1789865 : binding_slot &operator= (tree t)
112 : {
113 1789865 : u.binding = t;
114 1789865 : return *this;
115 : }
116 4924374 : bool is_lazy () const
117 : {
118 4874681 : return bool (uintptr_t (u.binding) & 1);
119 : }
120 1309319 : void set_lazy (unsigned snum)
121 : {
122 1309319 : gcc_checking_assert (!u.binding);
123 1309319 : u.binding = tree (uintptr_t ((snum << 1) | 1));
124 1309319 : }
125 : void or_lazy (unsigned snum)
126 : {
127 : gcc_checking_assert (is_lazy ());
128 : u.binding = tree (uintptr_t (u.binding) | (snum << 1));
129 : }
130 49693 : unsigned get_lazy () const
131 : {
132 49693 : gcc_checking_assert (is_lazy ());
133 49693 : return unsigned (uintptr_t (u.binding) >> 1);
134 : }
135 : };
136 :
137 : /* Bindings for modules are held in a sparse array. There is always a
138 : current TU slot, others are allocated as needed. By construction
139 : of the importing mechanism we only ever need to append to the
140 : array. Rather than have straight index/slot tuples, we bunch them
141 : up for greater packing.
142 :
143 : The cluster representation packs well on a 64-bit system. */
144 :
145 : #define BINDING_VECTOR_SLOTS_PER_CLUSTER 2
146 : struct binding_index {
147 : unsigned short base;
148 : unsigned short span;
149 : };
150 :
151 : struct GTY(()) binding_cluster
152 : {
153 : binding_index GTY((skip)) indices[BINDING_VECTOR_SLOTS_PER_CLUSTER];
154 : binding_slot slots[BINDING_VECTOR_SLOTS_PER_CLUSTER];
155 : };
156 :
157 : /* These two fields overlay lang flags. So don't use those. */
158 : #define BINDING_VECTOR_ALLOC_CLUSTERS(NODE) \
159 : (BINDING_VECTOR_CHECK (NODE)->base.u.dependence_info.clique)
160 : #define BINDING_VECTOR_NUM_CLUSTERS(NODE) \
161 : (BINDING_VECTOR_CHECK (NODE)->base.u.dependence_info.base)
162 : #define BINDING_VECTOR_CLUSTER_BASE(NODE) \
163 : (((tree_binding_vec *)BINDING_VECTOR_CHECK (NODE))->vec)
164 : #define BINDING_VECTOR_CLUSTER_LAST(NODE) \
165 : (&BINDING_VECTOR_CLUSTER (NODE, BINDING_VECTOR_NUM_CLUSTERS (NODE) - 1))
166 : #define BINDING_VECTOR_CLUSTER(NODE,IX) \
167 : (((tree_binding_vec *)BINDING_VECTOR_CHECK (NODE))->vec[IX])
168 :
169 : struct module_tree_map_traits
170 : : simple_hashmap_traits<int_hash<unsigned, 0>, tree> {};
171 : typedef hash_map<unsigned, tree, module_tree_map_traits> module_tree_map_t;
172 :
173 : struct GTY(()) tree_binding_vec {
174 : struct tree_base base;
175 : tree name;
176 : module_tree_map_t *internal_decls;
177 : binding_cluster GTY((length ("%h.base.u.dependence_info.base"))) vec[1];
178 : };
179 :
180 : /* The name of a module vector. */
181 : #define BINDING_VECTOR_NAME(NODE) \
182 : (((tree_binding_vec *)BINDING_VECTOR_CHECK (NODE))->name)
183 : /* A collection of internal functions for ADL in this binding. */
184 : #define BINDING_VECTOR_INTERNAL_DECLS(NODE) \
185 : (((tree_binding_vec *)BINDING_VECTOR_CHECK (NODE))->internal_decls)
186 :
187 : /* tree_binding_vec does uses base.u.dependence_info.base field for
188 : length. It does not have lang_flag etc available! */
189 :
190 : /* These two flags note if a module-vector contains deduplicated
191 : bindings (i.e. multiple declarations in different imports). */
192 : /* This binding contains duplicate references to a global module
193 : entity. */
194 : #define BINDING_VECTOR_GLOBAL_DUPS_P(NODE) \
195 : (BINDING_VECTOR_CHECK (NODE)->base.static_flag)
196 : /* This binding contains duplicate references to a partioned module
197 : entity. */
198 : #define BINDING_VECTOR_PARTITION_DUPS_P(NODE) \
199 : (BINDING_VECTOR_CHECK (NODE)->base.volatile_flag)
200 :
201 : /* True if the binding slot has internal-linkage functions that should
202 : cause ADL to error. */
203 : #define MODULE_BINDING_INTERNAL_DECLS_P(NODE) \
204 : (OVERLOAD_CHECK (NODE)->base.private_flag)
205 :
206 : /* These two flags indicate the provenence of the bindings on this
207 : particular vector slot. We can of course determine this from slot
208 : number, but that's a relatively expensive lookup. This avoids
209 : that when iterating. */
210 : /* This slot is part of the global module (a header unit). */
211 : #define MODULE_BINDING_GLOBAL_P(NODE) \
212 : (OVERLOAD_CHECK (NODE)->base.static_flag)
213 : /* This slot is part of the current module (a partition or primary). */
214 : #define MODULE_BINDING_PARTITION_P(NODE) \
215 : (OVERLOAD_CHECK (NODE)->base.volatile_flag)
216 :
217 : extern void set_identifier_type_value (tree, tree);
218 : extern void push_binding (tree, tree, cp_binding_level*);
219 : extern void pop_local_binding (tree, tree);
220 : extern void pop_bindings_and_leave_scope (void);
221 : extern tree constructor_name (tree);
222 : extern bool constructor_name_p (tree, tree);
223 :
224 : /* The kinds of scopes we recognize. */
225 : enum scope_kind {
226 : sk_block = 0, /* An ordinary block scope. This enumerator must
227 : have the value zero because "cp_binding_level"
228 : is initialized by using "memset" to set the
229 : contents to zero, and the default scope kind
230 : is "sk_block". */
231 : sk_cleanup, /* A scope for (pseudo-)scope for cleanup. It is
232 : pseudo in that it is transparent to name lookup
233 : activities. */
234 : sk_try, /* A try-block. */
235 : sk_catch, /* A catch-block. */
236 : sk_for, /* The scope of the variable declared in a
237 : init-statement. */
238 : sk_template_for, /* Ditto for expansion statements. */
239 : sk_cond, /* The scope of the variable declared in the condition
240 : of an if or switch statement. */
241 : sk_stmt_expr, /* GNU statement expression block. */
242 : sk_function_parms, /* The scope containing function parameters. */
243 : sk_class, /* The scope containing the members of a class. */
244 : sk_scoped_enum, /* The scope containing the enumerators of a C++11
245 : scoped enumeration. */
246 : sk_namespace, /* The scope containing the members of a
247 : namespace, including the global scope. */
248 : sk_template_parms, /* A scope for template parameters. */
249 : sk_template_spec, /* Like sk_template_parms, but for an explicit
250 : specialization. Since, by definition, an
251 : explicit specialization is introduced by
252 : "template <>", this scope is always empty. */
253 : sk_transaction, /* A synchronized or atomic statement. */
254 : sk_omp, /* An OpenMP structured block. */
255 : sk_lambda, /* A lambda scope. */
256 : sk_contract, /* A C++26 contract-assertion scope.
257 : [basic.scope.contract] */
258 : sk_count /* Number of scope_kind enumerations. */
259 : };
260 :
261 : struct GTY(()) cp_class_binding {
262 : cxx_binding *base;
263 : /* The bound name. */
264 : tree identifier;
265 : };
266 :
267 : /* For each binding contour we allocate a binding_level structure
268 : which records the names defined in that contour.
269 : Contours include:
270 : 0) the global one
271 : 1) one for each function definition,
272 : where internal declarations of the parameters appear.
273 : 2) one for each compound statement,
274 : to record its declarations.
275 :
276 : The current meaning of a name can be found by searching the levels
277 : from the current one out to the global one.
278 :
279 : Off to the side, may be the class_binding_level. This exists only
280 : to catch class-local declarations. It is otherwise nonexistent.
281 :
282 : Also there may be binding levels that catch cleanups that must be
283 : run when exceptions occur. Thus, to see whether a name is bound in
284 : the current scope, it is not enough to look in the
285 : CURRENT_BINDING_LEVEL. You should use lookup_name_current_level
286 : instead. */
287 :
288 : struct GTY(()) cp_binding_level {
289 : /* A chain of _DECL nodes for all variables, constants, functions,
290 : and typedef types. These are in the reverse of the order
291 : supplied. There may be OVERLOADs on this list, too, but they
292 : are wrapped in TREE_LISTs; the TREE_VALUE is the OVERLOAD. */
293 : tree names;
294 :
295 : /* Using directives. */
296 : vec<tree, va_gc> *using_directives;
297 :
298 : /* For the binding level corresponding to a class, the entities
299 : declared in the class or its base classes. */
300 : vec<cp_class_binding, va_gc> *class_shadowed;
301 :
302 : /* Similar to class_shadowed, but for IDENTIFIER_TYPE_VALUE, and
303 : is used for all binding levels. The TREE_PURPOSE is the name of
304 : the entity, the TREE_TYPE is the associated type. In addition
305 : the TREE_VALUE is the IDENTIFIER_TYPE_VALUE before we entered
306 : the class. */
307 : tree type_shadowed;
308 :
309 : /* For each level (except not the global one),
310 : a chain of BLOCK nodes for all the levels
311 : that were entered and exited one level down. */
312 : tree blocks;
313 :
314 : /* The entity (namespace, class, function) the scope of which this
315 : binding contour corresponds to. Otherwise NULL. */
316 : tree this_entity;
317 :
318 : /* The binding level which this one is contained in (inherits from). */
319 : cp_binding_level *level_chain;
320 :
321 : /* STATEMENT_LIST for statements in this binding contour.
322 : Only used at present for SK_CLEANUP temporary bindings. */
323 : tree statement_list;
324 :
325 : /* Binding depth at which this level began. */
326 : int binding_depth;
327 :
328 : /* The kind of scope that this object represents. However, a
329 : SK_TEMPLATE_SPEC scope is represented with KIND set to
330 : SK_TEMPLATE_PARMS and EXPLICIT_SPEC_P set to true. */
331 : ENUM_BITFIELD (scope_kind) kind : 5;
332 :
333 : /* True if this scope is an SK_TEMPLATE_SPEC scope. This field is
334 : only valid if KIND == SK_TEMPLATE_PARMS. */
335 : BOOL_BITFIELD explicit_spec_p : 1;
336 :
337 : /* True means make a BLOCK for this level regardless of all else. */
338 : unsigned keep : 1;
339 :
340 : /* Nonzero if this level can safely have additional
341 : cleanup-needing variables added to it. */
342 : unsigned more_cleanups_ok : 1;
343 : unsigned have_cleanups : 1;
344 :
345 : /* Transient state set if this scope is of sk_class kind
346 : and is in the process of defining 'this_entity'. Reset
347 : on leaving the class definition to allow for the scope
348 : to be subsequently re-used as a non-defining scope for
349 : 'this_entity'. */
350 : unsigned defining_class_p : 1;
351 :
352 : /* True for SK_FUNCTION_PARMS of a requires-expression. */
353 : unsigned requires_expression : 1;
354 :
355 : /* True for artificial blocks which should be ignored when finding
356 : parent scope. */
357 : unsigned artificial : 1;
358 :
359 : /* 20 bits left to fill a 32-bit word. */
360 : };
361 :
362 : /* The binding level currently in effect. */
363 :
364 : #define current_binding_level \
365 : (*(cfun && cp_function_chain && cp_function_chain->bindings \
366 : ? &cp_function_chain->bindings \
367 : : &scope_chain->bindings))
368 :
369 : /* The binding level of the current class, if any. */
370 :
371 : #define class_binding_level scope_chain->class_bindings
372 :
373 : /* True if SCOPE designates the global scope binding contour. */
374 : #define global_scope_p(SCOPE) \
375 : ((SCOPE) == NAMESPACE_LEVEL (global_namespace))
376 :
377 : extern cp_binding_level *leave_scope (void);
378 : extern bool kept_level_p (void);
379 : extern bool global_bindings_p (void);
380 : extern bool toplevel_bindings_p (void);
381 : extern bool namespace_bindings_p (void);
382 : extern bool local_bindings_p (void);
383 : extern bool template_parm_scope_p (void);
384 : extern scope_kind innermost_scope_kind (void);
385 : extern cp_binding_level *begin_scope (scope_kind, tree);
386 : extern void print_binding_stack (void);
387 : extern void pop_everything (void);
388 : extern void keep_next_level (bool);
389 : extern bool is_ancestor (tree ancestor, tree descendant);
390 : extern bool is_nested_namespace (tree parent, tree descendant,
391 : bool inline_only = false);
392 : extern tree push_scope (tree);
393 : extern void pop_scope (tree);
394 : extern tree push_inner_scope (tree);
395 : extern void pop_inner_scope (tree, tree);
396 : extern void push_binding_level (cp_binding_level *);
397 :
398 : extern bool handle_namespace_attrs (tree, tree);
399 : extern void pushlevel_class (void);
400 : extern void poplevel_class (void);
401 :
402 : /* What kind of scopes name lookup looks in. An enum class so we
403 : don't accidentally mix integers. */
404 : enum class LOOK_where
405 : {
406 : BLOCK = 1 << 0, /* Consider block scopes. */
407 : CLASS = 1 << 1, /* Consider class scopes. */
408 : NAMESPACE = 1 << 2, /* Consider namespace scopes. */
409 :
410 : ALL = BLOCK | CLASS | NAMESPACE,
411 : BLOCK_NAMESPACE = BLOCK | NAMESPACE,
412 : CLASS_NAMESPACE = CLASS | NAMESPACE,
413 : };
414 : constexpr LOOK_where operator| (LOOK_where a, LOOK_where b)
415 : {
416 : return LOOK_where (unsigned (a) | unsigned (b));
417 : }
418 : constexpr LOOK_where operator& (LOOK_where a, LOOK_where b)
419 : {
420 : return LOOK_where (unsigned (a) & unsigned (b));
421 : }
422 :
423 : enum class LOOK_want
424 : {
425 : NORMAL = 0, /* Normal lookup -- non-types can hide implicit types. */
426 : TYPE = 1 << 1, /* We only want TYPE_DECLS. */
427 : NAMESPACE = 1 << 2, /* We only want NAMESPACE_DECLS. */
428 :
429 : HIDDEN_FRIEND = 1 << 3, /* See hidden friends. */
430 : HIDDEN_LAMBDA = 1 << 4, /* See lambda-ignored entities. */
431 :
432 : ANY_REACHABLE = 1 << 5, /* Include reachable module declarations not
433 : normally visible to name lookup. */
434 :
435 : TYPE_NAMESPACE = TYPE | NAMESPACE, /* Either NAMESPACE or TYPE. */
436 : };
437 : constexpr LOOK_want operator| (LOOK_want a, LOOK_want b)
438 : {
439 : return LOOK_want (unsigned (a) | unsigned (b));
440 : }
441 : constexpr LOOK_want operator& (LOOK_want a, LOOK_want b)
442 : {
443 : return LOOK_want (unsigned (a) & unsigned (b));
444 : }
445 :
446 : extern tree lookup_name (tree, LOOK_where, LOOK_want = LOOK_want::NORMAL);
447 : /* Also declared in c-family/c-common.h. */
448 : extern tree lookup_name (tree name);
449 4351686471 : inline tree lookup_name (tree name, LOOK_want want)
450 : {
451 4351686471 : return lookup_name (name, LOOK_where::ALL, want);
452 : }
453 :
454 : enum class TAG_how
455 : {
456 : CURRENT_ONLY = 0, // Look and insert only in current scope
457 :
458 : GLOBAL = 1, // Unqualified lookup, innermost-non-class insertion
459 :
460 : INNERMOST_NON_CLASS = 2, // Look and insert only into
461 : // innermost-non-class
462 :
463 : HIDDEN_FRIEND = 3, // As INNERMOST_NON_CLASS, but hide it
464 : };
465 :
466 : extern tree lookup_elaborated_type (tree, TAG_how);
467 : extern tree get_namespace_binding (tree ns, tree id);
468 : extern void set_global_binding (tree decl);
469 11165594 : inline tree get_global_binding (tree id)
470 : {
471 11158166 : return get_namespace_binding (NULL_TREE, id);
472 : }
473 : extern tree lookup_qualified_name (tree scope, tree name,
474 : LOOK_want = LOOK_want::NORMAL,
475 : bool = true);
476 : extern tree lookup_qualified_name (tree scope, const char *name,
477 : LOOK_want = LOOK_want::NORMAL,
478 : bool = true);
479 : extern bool pushdecl_class_level (tree);
480 : extern tree pushdecl_namespace_level (tree, bool hiding = false);
481 : extern bool push_class_level_binding (tree, tree);
482 : extern tree get_local_decls ();
483 : extern int function_parm_depth (void);
484 : extern tree cp_namespace_decls (tree);
485 : extern void set_decl_namespace (tree, tree, bool);
486 : extern void push_decl_namespace (tree);
487 : extern void pop_decl_namespace (void);
488 : extern void do_namespace_alias (location_t, tree, tree);
489 : extern tree do_class_using_decl (tree, tree);
490 : extern tree lookup_arg_dependent (tree, tree, vec<tree, va_gc> *,
491 : bool tentative = false);
492 : extern tree search_anon_aggr (tree, tree, bool = false);
493 : extern tree get_class_binding_direct (tree, tree, bool want_type = false);
494 : extern tree get_class_binding (tree, tree, bool want_type = false);
495 : extern tree *find_member_slot (tree klass, tree name);
496 : extern tree *add_member_slot (tree klass, tree name);
497 : extern void resort_type_member_vec (void *, void *,
498 : gt_pointer_operator, void *);
499 : extern vec<tree, va_gc> *set_class_bindings (tree, int extra = 0);
500 : extern void insert_late_enum_def_bindings (tree, tree);
501 : extern tree innermost_non_namespace_value (tree);
502 : extern bool decl_in_scope_p (tree);
503 : extern cxx_binding *outer_binding (tree, cxx_binding *, bool);
504 : extern void cp_emit_debug_info_for_using (tree, tree);
505 :
506 : extern void finish_nonmember_using_decl (tree scope, tree name);
507 : extern void finish_using_directive (tree target, tree attribs);
508 : void push_local_extern_decl_alias (tree decl);
509 : extern tree pushdecl (tree, bool hiding = false);
510 : extern tree pushdecl_outermost_localscope (tree);
511 : extern tree pushdecl_top_level (tree);
512 : extern tree pushdecl_top_level_and_finish (tree, tree);
513 : extern tree pushtag (tree, tree, TAG_how = TAG_how::CURRENT_ONLY);
514 : extern int push_namespace (tree, bool make_inline = false);
515 : extern void pop_namespace (void);
516 : extern void push_nested_namespace (tree);
517 : extern void pop_nested_namespace (tree);
518 : extern void push_to_top_level (void);
519 : extern void pop_from_top_level (void);
520 : extern bool maybe_push_to_top_level (tree);
521 : extern void maybe_pop_from_top_level (bool);
522 : extern void push_using_decl_bindings (tree, tree);
523 : extern void expose_existing_namespace (tree);
524 :
525 : /* Lower level interface for modules. */
526 : extern tree *mergeable_namespace_slots (tree ns, tree name, bool is_attached,
527 : tree *mvec);
528 : extern void add_mergeable_namespace_entity (tree *slot, tree decl);
529 : extern tree lookup_class_binding (tree ctx, tree name);
530 : extern bool import_module_binding (tree ctx, tree name, unsigned mod,
531 : unsigned snum);
532 : extern bool set_module_binding (tree ctx, tree name, unsigned mod,
533 : bool global_p, bool partition_p,
534 : tree value, tree type, tree visible,
535 : tree internal);
536 : extern void add_module_namespace_decl (tree ns, tree decl);
537 : extern void add_imported_using_namespace (tree, tree);
538 :
539 : enum WMB_Flags
540 : {
541 : WMB_None = 0,
542 : WMB_Dups = 1 << 0,
543 : WMB_Export = 1 << 1,
544 : WMB_Using = 1 << 2,
545 : WMB_Hidden = 1 << 3,
546 : WMB_Purview = 1 << 4,
547 : };
548 : inline WMB_Flags operator|(WMB_Flags x, WMB_Flags y)
549 : { return WMB_Flags(+x|y); }
550 : inline WMB_Flags& operator|=(WMB_Flags& x, WMB_Flags y)
551 : { return x = x|y; }
552 :
553 : extern unsigned walk_module_binding (tree binding, bitmap partitions,
554 : bool (*)(tree decl, WMB_Flags, void *data),
555 : void *data);
556 : extern tree add_imported_namespace (tree ctx, tree name, location_t,
557 : unsigned module,
558 : bool inline_p, bool visible_p);
559 : extern const char *get_cxx_dialect_name (enum cxx_dialect dialect);
560 :
561 : #endif /* GCC_CP_NAME_LOOKUP_H */
|