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