00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef GCC_CP_TREE_H
00027 #define GCC_CP_TREE_H
00028
00029 #include "ggc.h"
00030 #include "function.h"
00031 #include "hashtab.h"
00032 #include "splay-tree.h"
00033 #include "vec.h"
00034 #include "varray.h"
00035 #include "c-common.h"
00036 #include "name-lookup.h"
00037 struct diagnostic_context;
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170 #define VAR_OR_FUNCTION_DECL_CHECK(NODE) \
00171 TREE_CHECK2(NODE,VAR_DECL,FUNCTION_DECL)
00172
00173 #define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \
00174 TREE_CHECK3(NODE,VAR_DECL,FUNCTION_DECL,PARM_DECL)
00175
00176 #define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
00177 TREE_CHECK4(NODE,VAR_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
00178
00179 #define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
00180 TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
00181
00182 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
00183 #define NON_THUNK_FUNCTION_CHECK(NODE) __extension__ \
00184 ({ const tree __t = (NODE); \
00185 if (TREE_CODE (__t) != FUNCTION_DECL && \
00186 TREE_CODE (__t) != TEMPLATE_DECL && __t->decl_common.lang_specific \
00187 && __t->decl_common.lang_specific->decl_flags.thunk_p) \
00188 tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
00189 __t; })
00190 #define THUNK_FUNCTION_CHECK(NODE) __extension__ \
00191 ({ const tree __t = (NODE); \
00192 if (TREE_CODE (__t) != FUNCTION_DECL || !__t->decl_common.lang_specific \
00193 || !__t->decl_common.lang_specific->decl_flags.thunk_p) \
00194 tree_check_failed (__t, __FILE__, __LINE__, __FUNCTION__, 0); \
00195 __t; })
00196 #else
00197 #define NON_THUNK_FUNCTION_CHECK(NODE) (NODE)
00198 #define THUNK_FUNCTION_CHECK(NODE) (NODE)
00199 #endif
00200
00201
00202
00203 struct lang_identifier GTY(())
00204 {
00205 struct c_common_identifier c_common;
00206 cxx_binding *namespace_bindings;
00207 cxx_binding *bindings;
00208 tree class_template_info;
00209 tree label_value;
00210 };
00211
00212
00213
00214
00215
00216 #define C_IS_RESERVED_WORD(ID) TREE_LANG_FLAG_5 (ID)
00217
00218 #define LANG_IDENTIFIER_CAST(NODE) \
00219 ((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
00220
00221 struct template_parm_index_s GTY(())
00222 {
00223 struct tree_common common;
00224 HOST_WIDE_INT index;
00225 HOST_WIDE_INT level;
00226 HOST_WIDE_INT orig_level;
00227 tree decl;
00228 };
00229 typedef struct template_parm_index_s template_parm_index;
00230
00231 struct tinst_level_s GTY(())
00232 {
00233 struct tree_common common;
00234 tree decl;
00235 location_t locus;
00236 int in_system_header_p;
00237 };
00238 typedef struct tinst_level_s * tinst_level_t;
00239
00240 struct ptrmem_cst GTY(())
00241 {
00242 struct tree_common common;
00243
00244
00245 rtx rtl;
00246 tree member;
00247 };
00248 typedef struct ptrmem_cst * ptrmem_cst_t;
00249
00250 #define IDENTIFIER_GLOBAL_VALUE(NODE) \
00251 namespace_binding ((NODE), global_namespace)
00252 #define SET_IDENTIFIER_GLOBAL_VALUE(NODE, VAL) \
00253 set_namespace_binding ((NODE), global_namespace, (VAL))
00254 #define IDENTIFIER_NAMESPACE_VALUE(NODE) \
00255 namespace_binding ((NODE), current_namespace)
00256 #define SET_IDENTIFIER_NAMESPACE_VALUE(NODE, VAL) \
00257 set_namespace_binding ((NODE), current_namespace, (VAL))
00258
00259 #define CLEANUP_P(NODE) TREE_LANG_FLAG_0 (TRY_BLOCK_CHECK (NODE))
00260
00261 #define BIND_EXPR_TRY_BLOCK(NODE) \
00262 TREE_LANG_FLAG_0 (BIND_EXPR_CHECK (NODE))
00263
00264
00265 #define BIND_EXPR_BODY_BLOCK(NODE) \
00266 TREE_LANG_FLAG_3 (BIND_EXPR_CHECK (NODE))
00267 #define FUNCTION_NEEDS_BODY_BLOCK(NODE) \
00268 (DECL_CONSTRUCTOR_P (NODE) || DECL_DESTRUCTOR_P (NODE))
00269
00270 #define STATEMENT_LIST_NO_SCOPE(NODE) \
00271 TREE_LANG_FLAG_0 (STATEMENT_LIST_CHECK (NODE))
00272 #define STATEMENT_LIST_TRY_BLOCK(NODE) \
00273 TREE_LANG_FLAG_2 (STATEMENT_LIST_CHECK (NODE))
00274
00275
00276
00277
00278 #define STMT_IS_FULL_EXPR_P(NODE) TREE_LANG_FLAG_1 ((NODE))
00279
00280
00281 #define EXPR_STMT_STMT_EXPR_RESULT(NODE) \
00282 TREE_LANG_FLAG_0 (EXPR_STMT_CHECK (NODE))
00283
00284
00285 #define STMT_EXPR_NO_SCOPE(NODE) \
00286 TREE_LANG_FLAG_0 (STMT_EXPR_CHECK (NODE))
00287
00288
00289
00290 #define same_type_p(TYPE1, TYPE2) \
00291 comptypes ((TYPE1), (TYPE2), COMPARE_STRICT)
00292
00293
00294
00295 #define same_type_ignoring_top_level_qualifiers_p(TYPE1, TYPE2) \
00296 same_type_p (TYPE_MAIN_VARIANT (TYPE1), TYPE_MAIN_VARIANT (TYPE2))
00297
00298
00299
00300 #define building_stmt_tree() (cur_stmt_list != NULL_TREE)
00301
00302
00303
00304 #define DECL_MAIN_P(NODE) \
00305 (DECL_EXTERN_C_FUNCTION_P (NODE) \
00306 && DECL_NAME (NODE) != NULL_TREE \
00307 && MAIN_NAME_P (DECL_NAME (NODE)))
00308
00309
00310 #define OVL_FUNCTION(NODE) \
00311 (((struct tree_overload*)OVERLOAD_CHECK (NODE))->function)
00312 #define OVL_CHAIN(NODE) TREE_CHAIN (NODE)
00313
00314 #define OVL_CURRENT(NODE) \
00315 ((TREE_CODE (NODE) == OVERLOAD) ? OVL_FUNCTION (NODE) : (NODE))
00316 #define OVL_NEXT(NODE) \
00317 ((TREE_CODE (NODE) == OVERLOAD) ? TREE_CHAIN (NODE) : NULL_TREE)
00318
00319
00320
00321 #define OVL_USED(NODE) TREE_USED (NODE)
00322
00323 struct tree_overload GTY(())
00324 {
00325 struct tree_common common;
00326 tree function;
00327 };
00328
00329
00330 #define BASELINK_P(NODE) \
00331 (TREE_CODE (NODE) == BASELINK)
00332
00333 #define BASELINK_BINFO(NODE) \
00334 (((struct tree_baselink*) BASELINK_CHECK (NODE))->binfo)
00335
00336
00337 #define BASELINK_FUNCTIONS(NODE) \
00338 (((struct tree_baselink*) BASELINK_CHECK (NODE))->functions)
00339
00340
00341
00342 #define BASELINK_ACCESS_BINFO(NODE) \
00343 (((struct tree_baselink*) BASELINK_CHECK (NODE))->access_binfo)
00344
00345
00346
00347
00348
00349 #define BASELINK_OPTYPE(NODE) \
00350 (TREE_CHAIN (BASELINK_CHECK (NODE)))
00351
00352 #define BASELINK_QUALIFIED_P(NODE) \
00353 TREE_LANG_FLAG_0 (BASELINK_CHECK (NODE))
00354
00355 struct tree_baselink GTY(())
00356 {
00357 struct tree_common common;
00358 tree binfo;
00359 tree functions;
00360 tree access_binfo;
00361 };
00362
00363
00364
00365 typedef enum cp_id_kind
00366 {
00367
00368 CP_ID_KIND_NONE,
00369
00370 CP_ID_KIND_UNQUALIFIED,
00371
00372 CP_ID_KIND_UNQUALIFIED_DEPENDENT,
00373
00374 CP_ID_KIND_TEMPLATE_ID,
00375
00376 CP_ID_KIND_QUALIFIED
00377 } cp_id_kind;
00378
00379
00380
00381 #define IDENTIFIER_NAMESPACE_BINDINGS(NODE) \
00382 (LANG_IDENTIFIER_CAST (NODE)->namespace_bindings)
00383 #define IDENTIFIER_TEMPLATE(NODE) \
00384 (LANG_IDENTIFIER_CAST (NODE)->class_template_info)
00385
00386
00387
00388
00389
00390
00391
00392
00393 #define IDENTIFIER_BINDING(NODE) \
00394 (LANG_IDENTIFIER_CAST (NODE)->bindings)
00395
00396
00397
00398
00399
00400 #define IDENTIFIER_TYPE_VALUE(NODE) identifier_type_value (NODE)
00401 #define REAL_IDENTIFIER_TYPE_VALUE(NODE) TREE_TYPE (NODE)
00402 #define SET_IDENTIFIER_TYPE_VALUE(NODE,TYPE) (TREE_TYPE (NODE) = (TYPE))
00403 #define IDENTIFIER_HAS_TYPE_VALUE(NODE) (IDENTIFIER_TYPE_VALUE (NODE) ? 1 : 0)
00404
00405 #define IDENTIFIER_LABEL_VALUE(NODE) \
00406 (LANG_IDENTIFIER_CAST (NODE)->label_value)
00407 #define SET_IDENTIFIER_LABEL_VALUE(NODE, VALUE) \
00408 IDENTIFIER_LABEL_VALUE (NODE) = (VALUE)
00409
00410
00411
00412 #define IDENTIFIER_VIRTUAL_P(NODE) TREE_LANG_FLAG_1 (NODE)
00413
00414
00415
00416 #define IDENTIFIER_OPNAME_P(NODE) TREE_LANG_FLAG_2 (NODE)
00417
00418
00419
00420 #define IDENTIFIER_TYPENAME_P(NODE) \
00421 TREE_LANG_FLAG_4 (NODE)
00422
00423
00424
00425 #define IDENTIFIER_CTOR_OR_DTOR_P(NODE) \
00426 TREE_LANG_FLAG_3 (NODE)
00427
00428
00429
00430
00431 #define IDENTIFIER_REPO_CHOSEN(NAME) \
00432 (TREE_LANG_FLAG_6 (NAME))
00433
00434
00435 #define C_TYPE_FIELDS_READONLY(TYPE) \
00436 (LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly)
00437
00438
00439
00440 #define DEFARG_TOKENS(NODE) \
00441 (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->tokens)
00442 #define DEFARG_INSTANTIATIONS(NODE) \
00443 (((struct tree_default_arg *)DEFAULT_ARG_CHECK (NODE))->instantiations)
00444
00445 struct tree_default_arg GTY (())
00446 {
00447 struct tree_common common;
00448 struct cp_token_cache *tokens;
00449 VEC(tree,gc) *instantiations;
00450 };
00451
00452 enum cp_tree_node_structure_enum {
00453 TS_CP_GENERIC,
00454 TS_CP_IDENTIFIER,
00455 TS_CP_TPI,
00456 TS_CP_TINST_LEVEL,
00457 TS_CP_PTRMEM,
00458 TS_CP_BINDING,
00459 TS_CP_OVERLOAD,
00460 TS_CP_BASELINK,
00461 TS_CP_WRAPPER,
00462 TS_CP_DEFAULT_ARG,
00463 LAST_TS_CP_ENUM
00464 };
00465
00466
00467 union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"),
00468 chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
00469 {
00470 union tree_node GTY ((tag ("TS_CP_GENERIC"),
00471 desc ("tree_node_structure (&%h)"))) generic;
00472 struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi;
00473 struct tinst_level_s GTY ((tag ("TS_CP_TINST_LEVEL"))) tinst_level;
00474 struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
00475 struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
00476 struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
00477 struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg;
00478 struct lang_identifier GTY ((tag ("TS_CP_IDENTIFIER"))) identifier;
00479 };
00480
00481
00482 enum cp_tree_index
00483 {
00484 CPTI_JAVA_BYTE_TYPE,
00485 CPTI_JAVA_SHORT_TYPE,
00486 CPTI_JAVA_INT_TYPE,
00487 CPTI_JAVA_LONG_TYPE,
00488 CPTI_JAVA_FLOAT_TYPE,
00489 CPTI_JAVA_DOUBLE_TYPE,
00490 CPTI_JAVA_CHAR_TYPE,
00491 CPTI_JAVA_BOOLEAN_TYPE,
00492
00493 CPTI_WCHAR_DECL,
00494 CPTI_VTABLE_ENTRY_TYPE,
00495 CPTI_DELTA_TYPE,
00496 CPTI_VTABLE_INDEX_TYPE,
00497 CPTI_CLEANUP_TYPE,
00498 CPTI_VTT_PARM_TYPE,
00499
00500 CPTI_CLASS_TYPE,
00501 CPTI_UNKNOWN_TYPE,
00502 CPTI_VTBL_TYPE,
00503 CPTI_VTBL_PTR_TYPE,
00504 CPTI_STD,
00505 CPTI_ABI,
00506 CPTI_CONST_TYPE_INFO_TYPE,
00507 CPTI_TYPE_INFO_PTR_TYPE,
00508 CPTI_ABORT_FNDECL,
00509 CPTI_GLOBAL_DELETE_FNDECL,
00510 CPTI_AGGR_TAG,
00511
00512 CPTI_CTOR_IDENTIFIER,
00513 CPTI_COMPLETE_CTOR_IDENTIFIER,
00514 CPTI_BASE_CTOR_IDENTIFIER,
00515 CPTI_DTOR_IDENTIFIER,
00516 CPTI_COMPLETE_DTOR_IDENTIFIER,
00517 CPTI_BASE_DTOR_IDENTIFIER,
00518 CPTI_DELETING_DTOR_IDENTIFIER,
00519 CPTI_DELTA_IDENTIFIER,
00520 CPTI_IN_CHARGE_IDENTIFIER,
00521 CPTI_VTT_PARM_IDENTIFIER,
00522 CPTI_NELTS_IDENTIFIER,
00523 CPTI_THIS_IDENTIFIER,
00524 CPTI_PFN_IDENTIFIER,
00525 CPTI_VPTR_IDENTIFIER,
00526 CPTI_STD_IDENTIFIER,
00527
00528 CPTI_LANG_NAME_C,
00529 CPTI_LANG_NAME_CPLUSPLUS,
00530 CPTI_LANG_NAME_JAVA,
00531
00532 CPTI_EMPTY_EXCEPT_SPEC,
00533 CPTI_JCLASS,
00534 CPTI_TERMINATE,
00535 CPTI_CALL_UNEXPECTED,
00536 CPTI_ATEXIT,
00537 CPTI_DSO_HANDLE,
00538 CPTI_DCAST,
00539
00540 CPTI_KEYED_CLASSES,
00541
00542 CPTI_MAX
00543 };
00544
00545 extern GTY(()) tree cp_global_trees[CPTI_MAX];
00546
00547 #define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE]
00548 #define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE]
00549 #define java_int_type_node cp_global_trees[CPTI_JAVA_INT_TYPE]
00550 #define java_long_type_node cp_global_trees[CPTI_JAVA_LONG_TYPE]
00551 #define java_float_type_node cp_global_trees[CPTI_JAVA_FLOAT_TYPE]
00552 #define java_double_type_node cp_global_trees[CPTI_JAVA_DOUBLE_TYPE]
00553 #define java_char_type_node cp_global_trees[CPTI_JAVA_CHAR_TYPE]
00554 #define java_boolean_type_node cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE]
00555
00556 #define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL]
00557 #define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE]
00558 /* The type used to represent an offset by which to adjust the `this'
00559 pointer in pointer-to-member types. */
00560 #define delta_type_node cp_global_trees[CPTI_DELTA_TYPE]
00561 /* The type used to represent an index into the vtable. */
00562 #define vtable_index_type cp_global_trees[CPTI_VTABLE_INDEX_TYPE]
00563
00564 #define class_type_node cp_global_trees[CPTI_CLASS_TYPE]
00565 #define unknown_type_node cp_global_trees[CPTI_UNKNOWN_TYPE]
00566 #define vtbl_type_node cp_global_trees[CPTI_VTBL_TYPE]
00567 #define vtbl_ptr_type_node cp_global_trees[CPTI_VTBL_PTR_TYPE]
00568 #define std_node cp_global_trees[CPTI_STD]
00569 #define abi_node cp_global_trees[CPTI_ABI]
00570 #define const_type_info_type_node cp_global_trees[CPTI_CONST_TYPE_INFO_TYPE]
00571 #define type_info_ptr_type cp_global_trees[CPTI_TYPE_INFO_PTR_TYPE]
00572 #define abort_fndecl cp_global_trees[CPTI_ABORT_FNDECL]
00573 #define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
00574 #define current_aggr cp_global_trees[CPTI_AGGR_TAG]
00575
00576 /* We cache these tree nodes so as to call get_identifier less
00577 frequently. */
00578
00579 /* The name of a constructor that takes an in-charge parameter to
00580 decide whether or not to construct virtual base classes. */
00581 #define ctor_identifier cp_global_trees[CPTI_CTOR_IDENTIFIER]
00582 /* The name of a constructor that constructs virtual base classes. */
00583 #define complete_ctor_identifier cp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER]
00584 /* The name of a constructor that does not construct virtual base classes. */
00585 #define base_ctor_identifier cp_global_trees[CPTI_BASE_CTOR_IDENTIFIER]
00586 /* The name of a destructor that takes an in-charge parameter to
00587 decide whether or not to destroy virtual base classes and whether
00588 or not to delete the object. */
00589 #define dtor_identifier cp_global_trees[CPTI_DTOR_IDENTIFIER]
00590 /* The name of a destructor that destroys virtual base classes. */
00591 #define complete_dtor_identifier cp_global_trees[CPTI_COMPLETE_DTOR_IDENTIFIER]
00592 /* The name of a destructor that does not destroy virtual base
00593 classes. */
00594 #define base_dtor_identifier cp_global_trees[CPTI_BASE_DTOR_IDENTIFIER]
00595 /* The name of a destructor that destroys virtual base classes, and
00596 then deletes the entire object. */
00597 #define deleting_dtor_identifier cp_global_trees[CPTI_DELETING_DTOR_IDENTIFIER]
00598 #define delta_identifier cp_global_trees[CPTI_DELTA_IDENTIFIER]
00599 #define in_charge_identifier cp_global_trees[CPTI_IN_CHARGE_IDENTIFIER]
00600 /* The name of the parameter that contains a pointer to the VTT to use
00601 for this subobject constructor or destructor. */
00602 #define vtt_parm_identifier cp_global_trees[CPTI_VTT_PARM_IDENTIFIER]
00603 #define nelts_identifier cp_global_trees[CPTI_NELTS_IDENTIFIER]
00604 #define this_identifier cp_global_trees[CPTI_THIS_IDENTIFIER]
00605 #define pfn_identifier cp_global_trees[CPTI_PFN_IDENTIFIER]
00606 #define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
00607 /* The name of the std namespace. */
00608 #define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER]
00609 #define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
00610 #define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
00611 #define lang_name_java cp_global_trees[CPTI_LANG_NAME_JAVA]
00612
00613 /* Exception specifier used for throw(). */
00614 #define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
00615
00616 /* If non-NULL, a POINTER_TYPE equivalent to (java::lang::Class*). */
00617 #define jclass_node cp_global_trees[CPTI_JCLASS]
00618
00619 /* The declaration for `std::terminate'. */
00620 #define terminate_node cp_global_trees[CPTI_TERMINATE]
00621
00622 /* The declaration for "__cxa_call_unexpected". */
00623 #define call_unexpected_node cp_global_trees[CPTI_CALL_UNEXPECTED]
00624
00625 /* A pointer to `std::atexit'. */
00626 #define atexit_node cp_global_trees[CPTI_ATEXIT]
00627
00628 /* A pointer to `__dso_handle'. */
00629 #define dso_handle_node cp_global_trees[CPTI_DSO_HANDLE]
00630
00631 /* The declaration of the dynamic_cast runtime. */
00632 #define dynamic_cast_node cp_global_trees[CPTI_DCAST]
00633
00634 /* The type of a destructor. */
00635 #define cleanup_type cp_global_trees[CPTI_CLEANUP_TYPE]
00636
00637 /* The type of the vtt parameter passed to subobject constructors and
00638 destructors. */
00639 #define vtt_parm_type cp_global_trees[CPTI_VTT_PARM_TYPE]
00640
00641 /* A TREE_LIST of the dynamic classes whose vtables may have to be
00642 emitted in this translation unit. */
00643
00644 #define keyed_classes cp_global_trees[CPTI_KEYED_CLASSES]
00645
00646 /* Node to indicate default access. This must be distinct from the
00647 access nodes in tree.h. */
00648
00649 #define access_default_node null_node
00650
00651 /* Global state. */
00652
00653 struct saved_scope GTY(())
00654 {
00655 VEC(cxx_saved_binding,gc) *old_bindings;
00656 tree old_namespace;
00657 tree decl_ns_list;
00658 tree class_name;
00659 tree class_type;
00660 tree access_specifier;
00661 tree function_decl;
00662 VEC(tree,gc) *lang_base;
00663 tree lang_name;
00664 tree template_parms;
00665 struct cp_binding_level *x_previous_class_level;
00666 tree x_saved_tree;
00667
00668 HOST_WIDE_INT x_processing_template_decl;
00669 int x_processing_specialization;
00670 bool x_processing_explicit_instantiation;
00671 int need_pop_function_context;
00672 bool skip_evaluation;
00673
00674 struct stmt_tree_s x_stmt_tree;
00675
00676 struct cp_binding_level *class_bindings;
00677 struct cp_binding_level *bindings;
00678
00679 struct saved_scope *prev;
00680 };
00681
00682 /* The current open namespace. */
00683
00684 #define current_namespace scope_chain->old_namespace
00685
00686 /* The stack for namespaces of current declarations. */
00687
00688 #define decl_namespace_list scope_chain->decl_ns_list
00689
00690 /* IDENTIFIER_NODE: name of current class */
00691
00692 #define current_class_name scope_chain->class_name
00693
00694 /* _TYPE: the type of the current class */
00695
00696 #define current_class_type scope_chain->class_type
00697
00698 /* When parsing a class definition, the access specifier most recently
00699 given by the user, or, if no access specifier was given, the
00700 default value appropriate for the kind of class (i.e., struct,
00701 class, or union). */
00702
00703 #define current_access_specifier scope_chain->access_specifier
00704
00705 /* Pointer to the top of the language name stack. */
00706
00707 #define current_lang_base scope_chain->lang_base
00708 #define current_lang_name scope_chain->lang_name
00709
00710 /* Parsing a function declarator leaves a list of parameter names
00711 or a chain or parameter decls here. */
00712
00713 #define current_template_parms scope_chain->template_parms
00714
00715 #define processing_template_decl scope_chain->x_processing_template_decl
00716 #define processing_specialization scope_chain->x_processing_specialization
00717 #define processing_explicit_instantiation scope_chain->x_processing_explicit_instantiation
00718
00719 /* The cached class binding level, from the most recently exited
00720 class, or NULL if none. */
00721
00722 #define previous_class_level scope_chain->x_previous_class_level
00723
00724 /* A list of private types mentioned, for deferred access checking. */
00725
00726 extern GTY(()) struct saved_scope *scope_chain;
00727
00728 struct cxx_int_tree_map GTY(())
00729 {
00730 unsigned int uid;
00731 tree to;
00732 };
00733
00734 extern unsigned int cxx_int_tree_map_hash (const void *);
00735 extern int cxx_int_tree_map_eq (const void *, const void *);
00736
00737 /* Global state pertinent to the current function. */
00738
00739 struct language_function GTY(())
00740 {
00741 struct c_language_function base;
00742
00743 tree x_cdtor_label;
00744 tree x_current_class_ptr;
00745 tree x_current_class_ref;
00746 tree x_eh_spec_block;
00747 tree x_in_charge_parm;
00748 tree x_vtt_parm;
00749 tree x_return_value;
00750
00751 int returns_value;
00752 int returns_null;
00753 int returns_abnormally;
00754 int in_function_try_handler;
00755 int in_base_initializer;
00756
00757 /* True if this function can throw an exception. */
00758 BOOL_BITFIELD can_throw : 1;
00759
00760 htab_t GTY((param_is(struct named_label_entry))) x_named_labels;
00761 struct cp_binding_level *bindings;
00762 VEC(tree,gc) *x_local_names;
00763 htab_t GTY((param_is (struct cxx_int_tree_map))) extern_decl_map;
00764 };
00765
00766 /* The current C++-specific per-function global variables. */
00767
00768 #define cp_function_chain (cfun->language)
00769
00770 /* In a constructor destructor, the point at which all derived class
00771 destroying/construction has been has been done. Ie. just before a
00772 constructor returns, or before any base class destroying will be done
00773 in a destructor. */
00774
00775 #define cdtor_label cp_function_chain->x_cdtor_label
00776
00777 /* When we're processing a member function, current_class_ptr is the
00778 PARM_DECL for the `this' pointer. The current_class_ref is an
00779 expression for `*this'. */
00780
00781 #define current_class_ptr \
00782 (cfun ? cp_function_chain->x_current_class_ptr : NULL_TREE)
00783 #define current_class_ref \
00784 (cfun ? cp_function_chain->x_current_class_ref : NULL_TREE)
00785
00786 /* The EH_SPEC_BLOCK for the exception-specifiers for the current
00787 function, if any. */
00788
00789 #define current_eh_spec_block cp_function_chain->x_eh_spec_block
00790
00791 /* The `__in_chrg' parameter for the current function. Only used for
00792 constructors and destructors. */
00793
00794 #define current_in_charge_parm cp_function_chain->x_in_charge_parm
00795
00796 /* The `__vtt_parm' parameter for the current function. Only used for
00797 constructors and destructors. */
00798
00799 #define current_vtt_parm cp_function_chain->x_vtt_parm
00800
00801 /* Set to 0 at beginning of a function definition, set to 1 if
00802 a return statement that specifies a return value is seen. */
00803
00804 #define current_function_returns_value cp_function_chain->returns_value
00805
00806 /* Set to 0 at beginning of a function definition, set to 1 if
00807 a return statement with no argument is seen. */
00808
00809 #define current_function_returns_null cp_function_chain->returns_null
00810
00811 /* Set to 0 at beginning of a function definition, set to 1 if
00812 a call to a noreturn function is seen. */
00813
00814 #define current_function_returns_abnormally \
00815 cp_function_chain->returns_abnormally
00816
00817 /* Nonzero if we are processing a base initializer. Zero elsewhere. */
00818 #define in_base_initializer cp_function_chain->in_base_initializer
00819
00820 #define in_function_try_handler cp_function_chain->in_function_try_handler
00821
00822 /* Expression always returned from function, or error_mark_node
00823 otherwise, for use by the automatic named return value optimization. */
00824
00825 #define current_function_return_value \
00826 (cp_function_chain->x_return_value)
00827
00828 /* True if NAME is the IDENTIFIER_NODE for an overloaded "operator
00829 new" or "operator delete". */
00830 #define NEW_DELETE_OPNAME_P(NAME) \
00831 ((NAME) == ansi_opname (NEW_EXPR) \
00832 || (NAME) == ansi_opname (VEC_NEW_EXPR) \
00833 || (NAME) == ansi_opname (DELETE_EXPR) \
00834 || (NAME) == ansi_opname (VEC_DELETE_EXPR))
00835
00836 #define ansi_opname(CODE) \
00837 (operator_name_info[(int) (CODE)].identifier)
00838 #define ansi_assopname(CODE) \
00839 (assignment_operator_name_info[(int) (CODE)].identifier)
00840
00841 /* True if NODE is an erroneous expression. */
00842
00843 #define error_operand_p(NODE) \
00844 ((NODE) == error_mark_node \
00845 || ((NODE) && TREE_TYPE ((NODE)) == error_mark_node))
00846
00847 /* C++ language-specific tree codes. */
00848 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
00849 enum cplus_tree_code {
00850 CP_DUMMY_TREE_CODE = LAST_C_TREE_CODE,
00851 #include "cp-tree.def"
00852 LAST_CPLUS_TREE_CODE
00853 };
00854 #undef DEFTREECODE
00855
00856 /* TRUE if a tree code represents a statement. */
00857 extern bool statement_code_p[MAX_TREE_CODES];
00858
00859 #define STATEMENT_CODE_P(CODE) statement_code_p[(int) (CODE)]
00860
00861 enum languages { lang_c, lang_cplusplus, lang_java };
00862
00863 /* Macros to make error reporting functions' lives easier. */
00864 #define TYPE_IDENTIFIER(NODE) (DECL_NAME (TYPE_NAME (NODE)))
00865 #define TYPE_LINKAGE_IDENTIFIER(NODE) \
00866 (TYPE_IDENTIFIER (TYPE_MAIN_VARIANT (NODE)))
00867 #define TYPE_NAME_STRING(NODE) (IDENTIFIER_POINTER (TYPE_IDENTIFIER (NODE)))
00868 #define TYPE_NAME_LENGTH(NODE) (IDENTIFIER_LENGTH (TYPE_IDENTIFIER (NODE)))
00869
00870 /* Nonzero if NODE has no name for linkage purposes. */
00871 #define TYPE_ANONYMOUS_P(NODE) \
00872 (TAGGED_TYPE_P (NODE) && ANON_AGGRNAME_P (TYPE_LINKAGE_IDENTIFIER (NODE)))
00873
00874 /* The _DECL for this _TYPE. */
00875 #define TYPE_MAIN_DECL(NODE) (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (NODE)))
00876
00877 /* Nonzero if T is a class (or struct or union) type. Also nonzero
00878 for template type parameters, typename types, and instantiated
00879 template template parameters. Despite its name,
00880 this macro has nothing to do with the definition of aggregate given
00881 in the standard. Think of this macro as MAYBE_CLASS_TYPE_P. Keep
00882 these checks in ascending code order. */
00883 #define IS_AGGR_TYPE(T) \
00884 (TREE_CODE (T) == TEMPLATE_TYPE_PARM \
00885 || TREE_CODE (T) == TYPENAME_TYPE \
00886 || TREE_CODE (T) == TYPEOF_TYPE \
00887 || TREE_CODE (T) == BOUND_TEMPLATE_TEMPLATE_PARM \
00888 || TYPE_LANG_FLAG_5 (T))
00889
00890 /* Set IS_AGGR_TYPE for T to VAL. T must be a class, struct, or
00891 union type. */
00892 #define SET_IS_AGGR_TYPE(T, VAL) \
00893 (TYPE_LANG_FLAG_5 (T) = (VAL))
00894
00895 /* Nonzero if T is a class type. Zero for template type parameters,
00896 typename types, and so forth. */
00897 #define CLASS_TYPE_P(T) \
00898 (IS_AGGR_TYPE_CODE (TREE_CODE (T)) && TYPE_LANG_FLAG_5 (T))
00899
00900 /* Keep these checks in ascending code order. */
00901 #define IS_AGGR_TYPE_CODE(T) \
00902 ((T) == RECORD_TYPE || (T) == UNION_TYPE)
00903 #define TAGGED_TYPE_P(T) \
00904 (CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
00905 #define IS_OVERLOAD_TYPE(T) TAGGED_TYPE_P (T)
00906
00907 /* True if this a "Java" type, defined in 'extern "Java"'. */
00908 #define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3 (NODE)
00909
00910 /* True if this type is dependent. This predicate is only valid if
00911 TYPE_DEPENDENT_P_VALID is true. */
00912 #define TYPE_DEPENDENT_P(NODE) TYPE_LANG_FLAG_0 (NODE)
00913
00914 /* True if dependent_type_p has been called for this type, with the
00915 result that TYPE_DEPENDENT_P is valid. */
00916 #define TYPE_DEPENDENT_P_VALID(NODE) TYPE_LANG_FLAG_6(NODE)
00917
00918 /* Nonzero if this type is const-qualified. */
00919 #define CP_TYPE_CONST_P(NODE) \
00920 ((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0)
00921
00922 /* Nonzero if this type is volatile-qualified. */
00923 #define CP_TYPE_VOLATILE_P(NODE) \
00924 ((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0)
00925
00926 /* Nonzero if this type is restrict-qualified. */
00927 #define CP_TYPE_RESTRICT_P(NODE) \
00928 ((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0)
00929
00930 /* Nonzero if this type is const-qualified, but not
00931 volatile-qualified. Other qualifiers are ignored. This macro is
00932 used to test whether or not it is OK to bind an rvalue to a
00933 reference. */
00934 #define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \
00935 ((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \
00936 == TYPE_QUAL_CONST)
00937
00938 #define FUNCTION_ARG_CHAIN(NODE) \
00939 TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (NODE)))
00940
00941 /* Given a FUNCTION_DECL, returns the first TREE_LIST out of TYPE_ARG_TYPES
00942 which refers to a user-written parameter. */
00943 #define FUNCTION_FIRST_USER_PARMTYPE(NODE) \
00944 skip_artificial_parms_for ((NODE), TYPE_ARG_TYPES (TREE_TYPE (NODE)))
00945
00946 /* Similarly, but for DECL_ARGUMENTS. */
00947 #define FUNCTION_FIRST_USER_PARM(NODE) \
00948 skip_artificial_parms_for ((NODE), DECL_ARGUMENTS (NODE))
00949
00950 #define PROMOTES_TO_AGGR_TYPE(NODE, CODE) \
00951 (((CODE) == TREE_CODE (NODE) \
00952 && IS_AGGR_TYPE (TREE_TYPE (NODE))) \
00953 || IS_AGGR_TYPE (NODE))
00954
00955 /* Nonzero iff TYPE is derived from PARENT. Ignores accessibility and
00956 ambiguity issues. */
00957 #define DERIVED_FROM_P(PARENT, TYPE) \
00958 (lookup_base ((TYPE), (PARENT), ba_any, NULL) != NULL_TREE)
00959 /* Nonzero iff TYPE is uniquely derived from PARENT. Ignores
00960 accessibility. */
00961 #define UNIQUELY_DERIVED_FROM_P(PARENT, TYPE) \
00962 (lookup_base ((TYPE), (PARENT), ba_unique | ba_quiet, NULL) != NULL_TREE)
00963 /* Nonzero iff TYPE is publicly & uniquely derived from PARENT. */
00964 #define PUBLICLY_UNIQUELY_DERIVED_P(PARENT, TYPE) \
00965 (lookup_base ((TYPE), (PARENT), ba_ignore_scope | ba_check | ba_quiet, \
00966 NULL) != NULL_TREE)
00967
00968 /* Gives the visibility specification for a class type. */
00969 #define CLASSTYPE_VISIBILITY(TYPE) \
00970 DECL_VISIBILITY (TYPE_NAME (TYPE))
00971 #define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE) \
00972 DECL_VISIBILITY_SPECIFIED (TYPE_NAME (TYPE))
00973
00974 typedef struct tree_pair_s GTY (())
00975 {
00976 tree purpose;
00977 tree value;
00978 } tree_pair_s;
00979 typedef tree_pair_s *tree_pair_p;
00980 DEF_VEC_O (tree_pair_s);
00981 DEF_VEC_ALLOC_O (tree_pair_s,gc);
00982
00983 /* This is a few header flags for 'struct lang_type'. Actually,
00984 all but the first are used only for lang_type_class; they
00985 are put in this structure to save space. */
00986 struct lang_type_header GTY(())
00987 {
00988 BOOL_BITFIELD is_lang_type_class : 1;
00989
00990 BOOL_BITFIELD has_type_conversion : 1;
00991 BOOL_BITFIELD has_init_ref : 1;
00992 BOOL_BITFIELD has_default_ctor : 1;
00993 BOOL_BITFIELD const_needs_init : 1;
00994 BOOL_BITFIELD ref_needs_init : 1;
00995 BOOL_BITFIELD has_const_assign_ref : 1;
00996
00997 BOOL_BITFIELD spare : 1;
00998 };
00999
01000 /* This structure provides additional information above and beyond
01001 what is provide in the ordinary tree_type. In the past, we used it
01002 for the types of class types, template parameters types, typename
01003 types, and so forth. However, there can be many (tens to hundreds
01004 of thousands) of template parameter types in a compilation, and
01005 there's no need for this additional information in that case.
01006 Therefore, we now use this data structure only for class types.
01007
01008 In the past, it was thought that there would be relatively few
01009 class types. However, in the presence of heavy use of templates,
01010 many (i.e., thousands) of classes can easily be generated.
01011 Therefore, we should endeavor to keep the size of this structure to
01012 a minimum. */
01013 struct lang_type_class GTY(())
01014 {
01015 struct lang_type_header h;
01016
01017 unsigned char align;
01018
01019 unsigned has_mutable : 1;
01020 unsigned com_interface : 1;
01021 unsigned non_pod_class : 1;
01022 unsigned nearly_empty_p : 1;
01023 unsigned user_align : 1;
01024 unsigned has_assign_ref : 1;
01025 unsigned has_new : 1;
01026 unsigned has_array_new : 1;
01027
01028 unsigned gets_delete : 2;
01029 unsigned interface_only : 1;
01030 unsigned interface_unknown : 1;
01031 unsigned contains_empty_class_p : 1;
01032 unsigned anon_aggr : 1;
01033 unsigned non_zero_init : 1;
01034 unsigned empty_p : 1;
01035
01036 unsigned vec_new_uses_cookie : 1;
01037 unsigned declared_class : 1;
01038 unsigned diamond_shaped : 1;
01039 unsigned repeated_base : 1;
01040 unsigned being_defined : 1;
01041 unsigned java_interface : 1;
01042 unsigned debug_requested : 1;
01043 unsigned fields_readonly : 1;
01044
01045 unsigned use_template : 2;
01046 unsigned ptrmemfunc_flag : 1;
01047 unsigned was_anonymous : 1;
01048 unsigned lazy_default_ctor : 1;
01049 unsigned lazy_copy_ctor : 1;
01050 unsigned lazy_assignment_op : 1;
01051 unsigned lazy_destructor : 1;
01052
01053 unsigned has_const_init_ref : 1;
01054 unsigned has_complex_init_ref : 1;
01055 unsigned has_complex_assign_ref : 1;
01056 unsigned non_aggregate : 1;
01057
01058 /* KEY: 1 if the copy constructor is implicitly defined instead of user
01059 defined. */
01060 unsigned has_implicit_copy_constructor : 1;
01061
01062 /* When adding a flag here, consider whether or not it ought to
01063 apply to a template instance if it applies to the template. If
01064 so, make sure to copy it in instantiate_class_template! */
01065
01066 /* There are some bits left to fill out a 32-bit word. Keep track
01067 of this by updating the size of this bitfield whenever you add or
01068 remove a flag. */
01069 unsigned dummy : 11; /* KEY: 12 in original GCC */
01070
01071 tree primary_base;
01072 VEC(tree_pair_s,gc) *vcall_indices;
01073 tree vtables;
01074 tree typeinfo_var;
01075 VEC(tree,gc) *vbases;
01076 binding_table nested_udts;
01077 tree as_base;
01078 VEC(tree,gc) *pure_virtuals;
01079 tree friend_classes;
01080 VEC(tree,gc) * GTY((reorder ("resort_type_method_vec"))) methods;
01081 tree key_method;
01082 tree decl_list;
01083 tree template_info;
01084 tree befriending_classes;
01085 /* In a RECORD_TYPE, information specific to Objective-C++, such
01086 as a list of adopted protocols or a pointer to a corresponding
01087 @interface. See objc/objc-act.h for details. */
01088 tree objc_info;
01089
01090 /* KEY: The copy constructor to use if the WHIRL translator needs to copy
01091 objects. */
01092 tree copy_constructor;
01093 };
01094
01095 struct lang_type_ptrmem GTY(())
01096 {
01097 struct lang_type_header h;
01098 tree record;
01099 };
01100
01101 struct lang_type GTY(())
01102 {
01103 union lang_type_u
01104 {
01105 struct lang_type_header GTY((skip (""))) h;
01106 struct lang_type_class GTY((tag ("1"))) c;
01107 struct lang_type_ptrmem GTY((tag ("0"))) ptrmem;
01108 } GTY((desc ("%h.h.is_lang_type_class"))) u;
01109 };
01110
01111 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
01112
01113 #define LANG_TYPE_CLASS_CHECK(NODE) __extension__ \
01114 ({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
01115 if (! lt->u.h.is_lang_type_class) \
01116 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
01117 <->u.c; })
01118
01119 #define LANG_TYPE_PTRMEM_CHECK(NODE) __extension__ \
01120 ({ struct lang_type *lt = TYPE_LANG_SPECIFIC (NODE); \
01121 if (lt->u.h.is_lang_type_class) \
01122 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
01123 <->u.ptrmem; })
01124
01125 #else
01126
01127 #define LANG_TYPE_CLASS_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.c)
01128 #define LANG_TYPE_PTRMEM_CHECK(NODE) (&TYPE_LANG_SPECIFIC (NODE)->u.ptrmem)
01129
01130 #endif /* ENABLE_TREE_CHECKING */
01131
01132 /* Fields used for storing information before the class is defined.
01133 After the class is defined, these fields hold other information. */
01134
01135 /* VEC(tree) of friends which were defined inline in this class
01136 definition. */
01137 #define CLASSTYPE_INLINE_FRIENDS(NODE) CLASSTYPE_PURE_VIRTUALS (NODE)
01138
01139 /* Nonzero for _CLASSTYPE means that operator delete is defined. */
01140 #define TYPE_GETS_DELETE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->gets_delete)
01141 #define TYPE_GETS_REG_DELETE(NODE) (TYPE_GETS_DELETE (NODE) & 1)
01142
01143 /* Nonzero if `new NODE[x]' should cause the allocation of extra
01144 storage to indicate how many array elements are in use. */
01145 #define TYPE_VEC_NEW_USES_COOKIE(NODE) \
01146 (CLASS_TYPE_P (NODE) \
01147 && LANG_TYPE_CLASS_CHECK (NODE)->vec_new_uses_cookie)
01148
01149 /* Nonzero means that this _CLASSTYPE node defines ways of converting
01150 itself to other types. */
01151 #define TYPE_HAS_CONVERSION(NODE) \
01152 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_type_conversion)
01153
01154 /* Nonzero means that NODE (a class type) has a default constructor --
01155 but that it has not yet been declared. */
01156 #define CLASSTYPE_LAZY_DEFAULT_CTOR(NODE) \
01157 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_default_ctor)
01158
01159 /* Nonzero means that NODE (a class type) has a copy constructor --
01160 but that it has not yet been declared. */
01161 #define CLASSTYPE_LAZY_COPY_CTOR(NODE) \
01162 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_copy_ctor)
01163
01164 /* Nonzero means that NODE (a class type) has an assignment operator
01165 -- but that it has not yet been declared. */
01166 #define CLASSTYPE_LAZY_ASSIGNMENT_OP(NODE) \
01167 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_assignment_op)
01168
01169 /* Nonzero means that NODE (a class type) has a destructor -- but that
01170 it has not yet been declared. */
01171 #define CLASSTYPE_LAZY_DESTRUCTOR(NODE) \
01172 (LANG_TYPE_CLASS_CHECK (NODE)->lazy_destructor)
01173
01174 /* Nonzero means that this _CLASSTYPE node overloads operator=(X&). */
01175 #define TYPE_HAS_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_assign_ref)
01176
01177 /* True iff the class type NODE has an "operator =" whose parameter
01178 has a parameter of type "const X&". */
01179 #define TYPE_HAS_CONST_ASSIGN_REF(NODE) \
01180 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_const_assign_ref)
01181
01182 /* Nonzero means that this _CLASSTYPE node has an X(X&) constructor. */
01183 #define TYPE_HAS_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->h.has_init_ref)
01184 #define TYPE_HAS_CONST_INIT_REF(NODE) \
01185 (LANG_TYPE_CLASS_CHECK (NODE)->has_const_init_ref)
01186
01187 /* Nonzero if this class defines an overloaded operator new. (An
01188 operator new [] doesn't count.) */
01189 #define TYPE_HAS_NEW_OPERATOR(NODE) \
01190 (LANG_TYPE_CLASS_CHECK (NODE)->has_new)
01191
01192 /* Nonzero if this class defines an overloaded operator new[]. */
01193 #define TYPE_HAS_ARRAY_NEW_OPERATOR(NODE) \
01194 (LANG_TYPE_CLASS_CHECK (NODE)->has_array_new)
01195
01196 /* Nonzero means that this type is being defined. I.e., the left brace
01197 starting the definition of this type has been seen. */
01198 #define TYPE_BEING_DEFINED(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->being_defined)
01199
01200 /* Mark bits for repeated base checks. */
01201 #define TYPE_MARKED_P(NODE) TREE_LANG_FLAG_6 (TYPE_CHECK (NODE))
01202
01203 /* Nonzero if the class NODE has multiple paths to the same (virtual)
01204 base object. */
01205 #define CLASSTYPE_DIAMOND_SHAPED_P(NODE) \
01206 (LANG_TYPE_CLASS_CHECK(NODE)->diamond_shaped)
01207
01208 /* Nonzero if the class NODE has multiple instances of the same base
01209 type. */
01210 #define CLASSTYPE_REPEATED_BASE_P(NODE) \
01211 (LANG_TYPE_CLASS_CHECK(NODE)->repeated_base)
01212
01213 /* The member function with which the vtable will be emitted:
01214 the first noninline non-pure-virtual member function. NULL_TREE
01215 if there is no key function or if this is a class template */
01216 #define CLASSTYPE_KEY_METHOD(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->key_method)
01217
01218 /* Vector member functions defined in this class. Each element is
01219 either a FUNCTION_DECL, a TEMPLATE_DECL, or an OVERLOAD. All
01220 functions with the same name end up in the same slot. The first
01221 two elements are for constructors, and destructors, respectively.
01222 All template conversion operators to innermost template dependent
01223 types are overloaded on the next slot, if they exist. Note, the
01224 names for these functions will not all be the same. The
01225 non-template conversion operators & templated conversions to
01226 non-innermost template types are next, followed by ordinary member
01227 functions. There may be empty entries at the end of the vector.
01228 The conversion operators are unsorted. The ordinary member
01229 functions are sorted, once the class is complete. */
01230 #define CLASSTYPE_METHOD_VEC(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->methods)
01231
01232 /* For class templates, this is a TREE_LIST of all member data,
01233 functions, types, and friends in the order of declaration.
01234 The TREE_PURPOSE of each TREE_LIST is NULL_TREE for a friend,
01235 and the RECORD_TYPE for the class template otherwise. */
01236 #define CLASSTYPE_DECL_LIST(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->decl_list)
01237
01238 /* The slot in the CLASSTYPE_METHOD_VEC where constructors go. */
01239 #define CLASSTYPE_CONSTRUCTOR_SLOT 0
01240
01241 /* The slot in the CLASSTYPE_METHOD_VEC where destructors go. */
01242 #define CLASSTYPE_DESTRUCTOR_SLOT 1
01243
01244 /* The first slot in the CLASSTYPE_METHOD_VEC where conversion
01245 operators can appear. */
01246 #define CLASSTYPE_FIRST_CONVERSION_SLOT 2
01247
01248 /* A FUNCTION_DECL or OVERLOAD for the constructors for NODE. These
01249 are the constructors that take an in-charge parameter. */
01250 #define CLASSTYPE_CONSTRUCTORS(NODE) \
01251 (VEC_index (tree, CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_CONSTRUCTOR_SLOT))
01252
01253 /* A FUNCTION_DECL for the destructor for NODE. These are the
01254 destructors that take an in-charge parameter. If
01255 CLASSTYPE_LAZY_DESTRUCTOR is true, then this entry will be NULL
01256 until the destructor is created with lazily_declare_fn. */
01257 #define CLASSTYPE_DESTRUCTORS(NODE) \
01258 (CLASSTYPE_METHOD_VEC (NODE) \
01259 ? VEC_index (tree, CLASSTYPE_METHOD_VEC (NODE), CLASSTYPE_DESTRUCTOR_SLOT) \
01260 : NULL_TREE)
01261
01262 /* A dictionary of the nested user-defined-types (class-types, or enums)
01263 found within this class. This table includes nested member class
01264 templates. */
01265 #define CLASSTYPE_NESTED_UTDS(NODE) \
01266 (LANG_TYPE_CLASS_CHECK (NODE)->nested_udts)
01267
01268 /* Nonzero if NODE has a primary base class, i.e., a base class with
01269 which it shares the virtual function table pointer. */
01270 #define CLASSTYPE_HAS_PRIMARY_BASE_P(NODE) \
01271 (CLASSTYPE_PRIMARY_BINFO (NODE) != NULL_TREE)
01272
01273 /* If non-NULL, this is the binfo for the primary base class, i.e.,
01274 the base class which contains the virtual function table pointer
01275 for this class. */
01276 #define CLASSTYPE_PRIMARY_BINFO(NODE) \
01277 (LANG_TYPE_CLASS_CHECK (NODE)->primary_base)
01278
01279 /* A vector of BINFOs for the direct and indirect virtual base classes
01280 that this type uses in a post-order depth-first left-to-right
01281 order. (In other words, these bases appear in the order that they
01282 should be initialized.) */
01283 #define CLASSTYPE_VBASECLASSES(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->vbases)
01284
01285 /* The type corresponding to NODE when NODE is used as a base class,
01286 i.e., NODE without virtual base classes. */
01287
01288 #define CLASSTYPE_AS_BASE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->as_base)
01289
01290 /* True iff NODE is the CLASSTYPE_AS_BASE version of some type. */
01291
01292 #define IS_FAKE_BASE_TYPE(NODE) \
01293 (TREE_CODE (NODE) == RECORD_TYPE \
01294 && TYPE_CONTEXT (NODE) && CLASS_TYPE_P (TYPE_CONTEXT (NODE)) \
01295 && CLASSTYPE_AS_BASE (TYPE_CONTEXT (NODE)) == (NODE))
01296
01297 /* These are the size and alignment of the type without its virtual
01298 base classes, for when we use this type as a base itself. */
01299 #define CLASSTYPE_SIZE(NODE) TYPE_SIZE (CLASSTYPE_AS_BASE (NODE))
01300 #define CLASSTYPE_SIZE_UNIT(NODE) TYPE_SIZE_UNIT (CLASSTYPE_AS_BASE (NODE))
01301 #define CLASSTYPE_ALIGN(NODE) TYPE_ALIGN (CLASSTYPE_AS_BASE (NODE))
01302 #define CLASSTYPE_USER_ALIGN(NODE) TYPE_USER_ALIGN (CLASSTYPE_AS_BASE (NODE))
01303
01304 /* The alignment of NODE, without its virtual bases, in bytes. */
01305 #define CLASSTYPE_ALIGN_UNIT(NODE) \
01306 (CLASSTYPE_ALIGN (NODE) / BITS_PER_UNIT)
01307
01308 /* True if this a Java interface type, declared with
01309 '__attribute__ ((java_interface))'. */
01310 #define TYPE_JAVA_INTERFACE(NODE) \
01311 (LANG_TYPE_CLASS_CHECK (NODE)->java_interface)
01312
01313 /* A VEC(tree) of virtual functions which cannot be inherited by
01314 derived classes. When deriving from this type, the derived
01315 class must provide its own definition for each of these functions. */
01316 #define CLASSTYPE_PURE_VIRTUALS(NODE) \
01317 (LANG_TYPE_CLASS_CHECK (NODE)->pure_virtuals)
01318
01319 /* Nonzero means that this type has an X() constructor. */
01320 #define TYPE_HAS_DEFAULT_CONSTRUCTOR(NODE) \
01321 (LANG_TYPE_CLASS_CHECK (NODE)->h.has_default_ctor)
01322
01323 /* Nonzero means that this type contains a mutable member. */
01324 #define CLASSTYPE_HAS_MUTABLE(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_mutable)
01325 #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
01326
01327 /* Nonzero means that this class type is a non-POD class. */
01328 #define CLASSTYPE_NON_POD_P(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->non_pod_class)
01329
01330 /* Nonzero means that this class contains pod types whose default
01331 initialization is not a zero initialization (namely, pointers to
01332 data members). */
01333 #define CLASSTYPE_NON_ZERO_INIT_P(NODE) \
01334 (LANG_TYPE_CLASS_CHECK (NODE)->non_zero_init)
01335
01336 /* Nonzero if this class is "empty" in the sense of the C++ ABI. */
01337 #define CLASSTYPE_EMPTY_P(NODE) \
01338 (LANG_TYPE_CLASS_CHECK (NODE)->empty_p)
01339
01340 /* Nonzero if this class is "nearly empty", i.e., contains only a
01341 virtual function table pointer. */
01342 #define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
01343 (LANG_TYPE_CLASS_CHECK (NODE)->nearly_empty_p)
01344
01345 /* Nonzero if this class contains an empty subobject. */
01346 #define CLASSTYPE_CONTAINS_EMPTY_CLASS_P(NODE) \
01347 (LANG_TYPE_CLASS_CHECK (NODE)->contains_empty_class_p)
01348
01349 /* A list of class types of which this type is a friend. The
01350 TREE_VALUE is normally a TYPE, but will be a TEMPLATE_DECL in the
01351 case of a template friend. */
01352 #define CLASSTYPE_FRIEND_CLASSES(NODE) \
01353 (LANG_TYPE_CLASS_CHECK (NODE)->friend_classes)
01354
01355 /* A list of the classes which grant friendship to this class. */
01356 #define CLASSTYPE_BEFRIENDING_CLASSES(NODE) \
01357 (LANG_TYPE_CLASS_CHECK (NODE)->befriending_classes)
01358
01359 /* Say whether this node was declared as a "class" or a "struct". */
01360 #define CLASSTYPE_DECLARED_CLASS(NODE) \
01361 (LANG_TYPE_CLASS_CHECK (NODE)->declared_class)
01362
01363 /* Nonzero if this class has const members
01364 which have no specified initialization. */
01365 #define CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE) \
01366 (TYPE_LANG_SPECIFIC (NODE) \
01367 ? LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init : 0)
01368 #define SET_CLASSTYPE_READONLY_FIELDS_NEED_INIT(NODE, VALUE) \
01369 (LANG_TYPE_CLASS_CHECK (NODE)->h.const_needs_init = (VALUE))
01370
01371 /* Nonzero if this class has ref members
01372 which have no specified initialization. */
01373 #define CLASSTYPE_REF_FIELDS_NEED_INIT(NODE) \
01374 (TYPE_LANG_SPECIFIC (NODE) \
01375 ? LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init : 0)
01376 #define SET_CLASSTYPE_REF_FIELDS_NEED_INIT(NODE, VALUE) \
01377 (LANG_TYPE_CLASS_CHECK (NODE)->h.ref_needs_init = (VALUE))
01378
01379 /* Nonzero if this class is included from a header file which employs
01380 `#pragma interface', and it is not included in its implementation file. */
01381 #define CLASSTYPE_INTERFACE_ONLY(NODE) \
01382 (LANG_TYPE_CLASS_CHECK (NODE)->interface_only)
01383
01384 /* True if we have already determined whether or not vtables, VTTs,
01385 typeinfo, and other similar per-class data should be emitted in
01386 this translation unit. This flag does not indicate whether or not
01387 these items should be emitted; it only indicates that we know one
01388 way or the other. */
01389 #define CLASSTYPE_INTERFACE_KNOWN(NODE) \
01390 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown == 0)
01391 /* The opposite of CLASSTYPE_INTERFACE_KNOWN. */
01392 #define CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
01393 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown)
01394
01395 #define SET_CLASSTYPE_INTERFACE_UNKNOWN_X(NODE,X) \
01396 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = !!(X))
01397 #define SET_CLASSTYPE_INTERFACE_UNKNOWN(NODE) \
01398 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 1)
01399 #define SET_CLASSTYPE_INTERFACE_KNOWN(NODE) \
01400 (LANG_TYPE_CLASS_CHECK (NODE)->interface_unknown = 0)
01401
01402 /* Nonzero if a _DECL node requires us to output debug info for this class. */
01403 #define CLASSTYPE_DEBUG_REQUESTED(NODE) \
01404 (LANG_TYPE_CLASS_CHECK (NODE)->debug_requested)
01405
01406 /* Additional macros for inheritance information. */
01407
01408 /* Nonzero means that this class is on a path leading to a new vtable. */
01409 #define BINFO_VTABLE_PATH_MARKED(NODE) BINFO_FLAG_1 (NODE)
01410
01411 /* Nonzero means B (a BINFO) has its own vtable. Any copies will not
01412 have this flag set. */
01413 #define BINFO_NEW_VTABLE_MARKED(B) (BINFO_FLAG_2 (B))
01414
01415 /* Compare a BINFO_TYPE with another type for equality. For a binfo,
01416 this is functionally equivalent to using same_type_p, but
01417 measurably faster. At least one of the arguments must be a
01418 BINFO_TYPE. The other can be a BINFO_TYPE or a regular type. If
01419 BINFO_TYPE(T) ever stops being the main variant of the class the
01420 binfo is for, this macro must change. */
01421 #define SAME_BINFO_TYPE_P(A, B) ((A) == (B))
01422
01423 /* Any subobject that needs a new vtable must have a vptr and must not
01424 be a non-virtual primary base (since it would then use the vtable from a
01425 derived class and never become non-primary.) */
01426 #define SET_BINFO_NEW_VTABLE_MARKED(B) \
01427 (BINFO_NEW_VTABLE_MARKED (B) = 1, \
01428 gcc_assert (!BINFO_PRIMARY_P (B) || BINFO_VIRTUAL_P (B)), \
01429 gcc_assert (TYPE_VFIELD (BINFO_TYPE (B))))
01430
01431 /* Nonzero if this binfo is for a dependent base - one that should not
01432 be searched. */
01433 #define BINFO_DEPENDENT_BASE_P(NODE) BINFO_FLAG_3 (NODE)
01434
01435 /* Nonzero if this binfo has lost its primary base binfo (because that
01436 is a nearly-empty virtual base that has been taken by some other
01437 base in the complete hierarchy. */
01438 #define BINFO_LOST_PRIMARY_P(NODE) BINFO_FLAG_4 (NODE)
01439
01440 /* Nonzero if this BINFO is a primary base class. */
01441 #define BINFO_PRIMARY_P(NODE) BINFO_FLAG_5(NODE)
01442
01443 /* Used by various search routines. */
01444 #define IDENTIFIER_MARKED(NODE) TREE_LANG_FLAG_0 (NODE)
01445
01446 /* A VEC(tree_pair_s) of the vcall indices associated with the class
01447 NODE. The PURPOSE of each element is a FUNCTION_DECL for a virtual
01448 function. The VALUE is the index into the virtual table where the
01449 vcall offset for that function is stored, when NODE is a virtual
01450 base. */
01451 #define CLASSTYPE_VCALL_INDICES(NODE) \
01452 (LANG_TYPE_CLASS_CHECK (NODE)->vcall_indices)
01453
01454 /* The various vtables for the class NODE. The primary vtable will be
01455 first, followed by the construction vtables and VTT, if any. */
01456 #define CLASSTYPE_VTABLES(NODE) \
01457 (LANG_TYPE_CLASS_CHECK (NODE)->vtables)
01458
01459 /* The std::type_info variable representing this class, or NULL if no
01460 such variable has been created. This field is only set for the
01461 TYPE_MAIN_VARIANT of the class. */
01462 #define CLASSTYPE_TYPEINFO_VAR(NODE) \
01463 (LANG_TYPE_CLASS_CHECK (NODE)->typeinfo_var)
01464
01465 /* Accessor macros for the BINFO_VIRTUALS list. */
01466
01467 /* The number of bytes by which to adjust the `this' pointer when
01468 calling this virtual function. Subtract this value from the this
01469 pointer. Always non-NULL, might be constant zero though. */
01470 #define BV_DELTA(NODE) (TREE_PURPOSE (NODE))
01471
01472 /* If non-NULL, the vtable index at which to find the vcall offset
01473 when calling this virtual function. Add the value at that vtable
01474 index to the this pointer. */
01475 #define BV_VCALL_INDEX(NODE) (TREE_TYPE (NODE))
01476
01477 /* The function to call. */
01478 #define BV_FN(NODE) (TREE_VALUE (NODE))
01479
01480
01481 /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that
01482 this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
01483 will be NULL_TREE to indicate a throw specification of `()', or
01484 no exceptions allowed. */
01485 #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_LANG_SLOT_1 (NODE)
01486
01487 /* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */
01488 #define TYPE_NOTHROW_P(NODE) \
01489 (TYPE_RAISES_EXCEPTIONS (NODE) \
01490 && TREE_VALUE (TYPE_RAISES_EXCEPTIONS (NODE)) == NULL_TREE)
01491
01492 /* The binding level associated with the namespace. */
01493 #define NAMESPACE_LEVEL(NODE) \
01494 (DECL_LANG_SPECIFIC (NODE)->decl_flags.u.level)
01495
01496
01497 /* If a DECL has DECL_LANG_SPECIFIC, it is either a lang_decl_flags or
01498 a lang_decl (which has lang_decl_flags as its initial prefix).
01499 This macro is nonzero for tree nodes whose DECL_LANG_SPECIFIC is
01500 the full lang_decl, and not just lang_decl_flags. Keep these
01501 checks in ascending code order. */
01502 #define CAN_HAVE_FULL_LANG_DECL_P(NODE) \
01503 (!(TREE_CODE (NODE) == FIELD_DECL \
01504 || TREE_CODE (NODE) == VAR_DECL \
01505 || TREE_CODE (NODE) == CONST_DECL \
01506 || TREE_CODE (NODE) == USING_DECL))
01507
01508 struct lang_decl_flags GTY(())
01509 {
01510 ENUM_BITFIELD(languages) language : 4;
01511 unsigned global_ctor_p : 1;
01512 unsigned global_dtor_p : 1;
01513 unsigned anticipated_p : 1;
01514 unsigned template_conv_p : 1;
01515
01516 unsigned operator_attr : 1;
01517 unsigned constructor_attr : 1;
01518 unsigned destructor_attr : 1;
01519 unsigned friend_attr : 1;
01520 unsigned static_function : 1;
01521 unsigned pure_virtual : 1;
01522 unsigned has_in_charge_parm_p : 1;
01523 unsigned has_vtt_parm_p : 1;
01524
01525 unsigned deferred : 1;
01526 unsigned use_template : 2;
01527 unsigned nonconverting : 1;
01528 unsigned not_really_extern : 1;
01529 unsigned initialized_in_class : 1;
01530 unsigned assignment_operator_p : 1;
01531 unsigned u1sel : 1;
01532
01533 unsigned u2sel : 1;
01534 unsigned can_be_full : 1;
01535 unsigned thunk_p : 1;
01536 unsigned this_thunk_p : 1;
01537 unsigned repo_available_p : 1;
01538 unsigned hidden_friend_p : 1;
01539 unsigned threadprivate_p : 1;
01540 /* One unused bit. */
01541
01542 union lang_decl_u {
01543 /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
01544 THUNK_ALIAS.
01545 In a FUNCTION_DECL for which DECL_THUNK_P does not hold,
01546 VAR_DECL, TYPE_DECL, or TEMPLATE_DECL, this is
01547 DECL_TEMPLATE_INFO. */
01548 tree GTY ((tag ("0"))) template_info;
01549
01550 /* In a NAMESPACE_DECL, this is NAMESPACE_LEVEL. */
01551 struct cp_binding_level * GTY ((tag ("1"))) level;
01552 } GTY ((desc ("%1.u1sel"))) u;
01553
01554 union lang_decl_u2 {
01555 /* In a FUNCTION_DECL for which DECL_THUNK_P holds, this is
01556 THUNK_VIRTUAL_OFFSET.
01557 Otherwise this is DECL_ACCESS. */
01558 tree GTY ((tag ("0"))) access;
01559
01560 /* For VAR_DECL in function, this is DECL_DISCRIMINATOR. */
01561 int GTY ((tag ("1"))) discriminator;
01562 } GTY ((desc ("%1.u2sel"))) u2;
01563 };
01564
01565 /* sorted_fields is sorted based on a pointer, so we need to be able
01566 to resort it if pointers get rearranged. */
01567
01568 struct lang_decl GTY(())
01569 {
01570 struct lang_decl_flags decl_flags;
01571
01572 union lang_decl_u4
01573 {
01574 struct full_lang_decl
01575 {
01576 /* In an overloaded operator, this is the value of
01577 DECL_OVERLOADED_OPERATOR_P. */
01578 ENUM_BITFIELD (tree_code) operator_code : 8;
01579
01580 unsigned u3sel : 1;
01581 unsigned pending_inline_p : 1;
01582 unsigned spare : 22;
01583
01584 /* For a non-thunk function decl, this is a tree list of
01585 friendly classes. For a thunk function decl, it is the
01586 thunked to function decl. */
01587 tree befriending_classes;
01588
01589 /* For a non-virtual FUNCTION_DECL, this is
01590 DECL_FRIEND_CONTEXT. For a virtual FUNCTION_DECL for which
01591 DECL_THIS_THUNK_P does not hold, this is DECL_THUNKS. Both
01592 this pointer and result pointer adjusting thunks are
01593 chained here. This pointer thunks to return pointer thunks
01594 will be chained on the return pointer thunk. */
01595 tree context;
01596
01597 union lang_decl_u5
01598 {
01599 /* In a non-thunk FUNCTION_DECL or TEMPLATE_DECL, this is
01600 DECL_CLONED_FUNCTION. */
01601 tree GTY ((tag ("0"))) cloned_function;
01602
01603 /* In a FUNCTION_DECL for which THUNK_P holds this is the
01604 THUNK_FIXED_OFFSET. */
01605 HOST_WIDE_INT GTY ((tag ("1"))) fixed_offset;
01606 } GTY ((desc ("%0.decl_flags.thunk_p"))) u5;
01607
01608 union lang_decl_u3
01609 {
01610 struct sorted_fields_type * GTY ((tag ("0"), reorder ("resort_sorted_fields")))
01611 sorted_fields;
01612 struct cp_token_cache * GTY ((tag ("2"))) pending_inline_info;
01613 struct language_function * GTY ((tag ("1")))
01614 saved_language_function;
01615 } GTY ((desc ("%1.u3sel + %1.pending_inline_p"))) u;
01616
01617 /* If the named return value optimization is applied to the function,
01618 this is the VAR_DECL of the named return object. */
01619 tree named_return_object; /* KEY */
01620
01621 } GTY ((tag ("1"))) f;
01622 } GTY ((desc ("%1.decl_flags.can_be_full"))) u;
01623 };
01624
01625 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
01626
01627 #define LANG_DECL_U2_CHECK(NODE, TF) __extension__ \
01628 ({ struct lang_decl *lt = DECL_LANG_SPECIFIC (NODE); \
01629 if (lt->decl_flags.u2sel != TF) \
01630 lang_check_failed (__FILE__, __LINE__, __FUNCTION__); \
01631 <->decl_flags.u2; })
01632
01633 #else
01634
01635 #define LANG_DECL_U2_CHECK(NODE, TF) \
01636 (&DECL_LANG_SPECIFIC (NODE)->decl_flags.u2)
01637
01638 #endif /* ENABLE_TREE_CHECKING */
01639
01640 /* For a FUNCTION_DECL or a VAR_DECL, the language linkage for the
01641 declaration. Some entities (like a member function in a local
01642 class, or a local variable) do not have linkage at all, and this
01643 macro should not be used in those cases.
01644
01645 Implementation note: A FUNCTION_DECL without DECL_LANG_SPECIFIC was
01646 created by language-independent code, and has C linkage. Most
01647 VAR_DECLs have C++ linkage, and do not have DECL_LANG_SPECIFIC, but
01648 we do create DECL_LANG_SPECIFIC for variables with non-C++ linkage. */
01649 #define DECL_LANGUAGE(NODE) \
01650 (DECL_LANG_SPECIFIC (NODE) \
01651 ? DECL_LANG_SPECIFIC (NODE)->decl_flags.language \
01652 : (TREE_CODE (NODE) == FUNCTION_DECL \
01653 ? lang_c : lang_cplusplus))
01654
01655 /* Set the language linkage for NODE to LANGUAGE. */
01656 #define SET_DECL_LANGUAGE(NODE, LANGUAGE) \
01657 (DECL_LANG_SPECIFIC (NODE)->decl_flags.language = (LANGUAGE))
01658
01659 /* For FUNCTION_DECLs: nonzero means that this function is a constructor. */
01660 #define DECL_CONSTRUCTOR_P(NODE) \
01661 (DECL_LANG_SPECIFIC (NODE)->decl_flags.constructor_attr)
01662
01663 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a complete
01664 object. */
01665 #define DECL_COMPLETE_CONSTRUCTOR_P(NODE) \
01666 (DECL_CONSTRUCTOR_P (NODE) \
01667 && DECL_NAME (NODE) == complete_ctor_identifier)
01668
01669 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor for a base
01670 object. */
01671 #define DECL_BASE_CONSTRUCTOR_P(NODE) \
01672 (DECL_CONSTRUCTOR_P (NODE) \
01673 && DECL_NAME (NODE) == base_ctor_identifier)
01674
01675 /* Nonzero if NODE (a FUNCTION_DECL) is a constructor, but not either the
01676 specialized in-charge constructor or the specialized not-in-charge
01677 constructor. */
01678 #define DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P(NODE) \
01679 (DECL_CONSTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE))
01680
01681 /* Nonzero if NODE (a FUNCTION_DECL) is a copy constructor. */
01682 #define DECL_COPY_CONSTRUCTOR_P(NODE) \
01683 (DECL_CONSTRUCTOR_P (NODE) && copy_fn_p (NODE) > 0)
01684
01685 /* Nonzero if NODE is a destructor. */
01686 #define DECL_DESTRUCTOR_P(NODE) \
01687 (DECL_LANG_SPECIFIC (NODE)->decl_flags.destructor_attr)
01688
01689 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor, but not the
01690 specialized in-charge constructor, in-charge deleting constructor,
01691 or the base destructor. */
01692 #define DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P(NODE) \
01693 (DECL_DESTRUCTOR_P (NODE) && !DECL_CLONED_FUNCTION_P (NODE))
01694
01695 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
01696 object. */
01697 #define DECL_COMPLETE_DESTRUCTOR_P(NODE) \
01698 (DECL_DESTRUCTOR_P (NODE) \
01699 && DECL_NAME (NODE) == complete_dtor_identifier)
01700
01701 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a base
01702 object. */
01703 #define DECL_BASE_DESTRUCTOR_P(NODE) \
01704 (DECL_DESTRUCTOR_P (NODE) \
01705 && DECL_NAME (NODE) == base_dtor_identifier)
01706
01707 /* Nonzero if NODE (a FUNCTION_DECL) is a destructor for a complete
01708 object that deletes the object after it has been destroyed. */
01709 #define DECL_DELETING_DESTRUCTOR_P(NODE) \
01710 (DECL_DESTRUCTOR_P (NODE) \
01711 && DECL_NAME (NODE) == deleting_dtor_identifier)
01712
01713 /* Nonzero if NODE (a FUNCTION_DECL) is a cloned constructor or
01714 destructor. */
01715 #define DECL_CLONED_FUNCTION_P(NODE) \
01716 ((TREE_CODE (NODE) == FUNCTION_DECL \
01717 || TREE_CODE (NODE) == TEMPLATE_DECL) \
01718 && DECL_LANG_SPECIFIC (NODE) \
01719 && !DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p \
01720 && DECL_CLONED_FUNCTION (NODE) != NULL_TREE)
01721
01722 /* If DECL_CLONED_FUNCTION_P holds, this is the function that was
01723 cloned. */
01724 #define DECL_CLONED_FUNCTION(NODE) \
01725 (DECL_LANG_SPECIFIC (NON_THUNK_FUNCTION_CHECK(NODE))->u.f.u5.cloned_function)
01726
01727 /* Perform an action for each clone of FN, if FN is a function with
01728 clones. This macro should be used like:
01729
01730 FOR_EACH_CLONE (clone, fn)
01731 { ... }
01732
01733 */
01734 #define FOR_EACH_CLONE(CLONE, FN) \
01735 if (TREE_CODE (FN) == FUNCTION_DECL \
01736 && (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (FN) \
01737 || DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (FN))) \
01738 for (CLONE = TREE_CHAIN (FN); \
01739 CLONE && DECL_CLONED_FUNCTION_P (CLONE); \
01740 CLONE = TREE_CHAIN (CLONE))
01741
01742 #ifdef KEY
01743 #define DECL_NAMED_RETURN_OBJECT(NODE) \
01744 (DECL_LANG_SPECIFIC (NODE)->u.f.named_return_object)
01745 #endif
01746
01747 /* Nonzero if NODE has DECL_DISCRIMINATOR and not DECL_ACCESS. */
01748 #define DECL_DISCRIMINATOR_P(NODE) \
01749 (TREE_CODE (NODE) == VAR_DECL \
01750 && DECL_FUNCTION_SCOPE_P (NODE))
01751
01752 /* Discriminator for name mangling. */
01753 #define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator)
01754
01755 /* Nonzero if the VTT parm has been added to NODE. */
01756 #define DECL_HAS_VTT_PARM_P(NODE) \
01757 (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_vtt_parm_p)
01758
01759 /* Nonzero if NODE is a FUNCTION_DECL for which a VTT parameter is
01760 required. */
01761 #define DECL_NEEDS_VTT_PARM_P(NODE) \
01762 (CLASSTYPE_VBASECLASSES (DECL_CONTEXT (NODE)) \
01763 && (DECL_BASE_CONSTRUCTOR_P (NODE) \
01764 || DECL_BASE_DESTRUCTOR_P (NODE)))
01765
01766 /* Nonzero if NODE is a user-defined conversion operator. */
01767 #define DECL_CONV_FN_P(NODE) \
01768 (DECL_NAME (NODE) && IDENTIFIER_TYPENAME_P (DECL_NAME (NODE)))
01769
01770 /* If FN is a conversion operator, the type to which it converts.
01771 Otherwise, NULL_TREE. */
01772 #define DECL_CONV_FN_TYPE(FN) \
01773 (DECL_CONV_FN_P (FN) ? TREE_TYPE (DECL_NAME (FN)) : NULL_TREE)
01774
01775 /* Nonzero if NODE, which is a TEMPLATE_DECL, is a template
01776 conversion operator to a type dependent on the innermost template
01777 args. */
01778 #define DECL_TEMPLATE_CONV_FN_P(NODE) \
01779 (DECL_LANG_SPECIFIC (NODE)->decl_flags.template_conv_p)
01780
01781 /* Set the overloaded operator code for NODE to CODE. */
01782 #define SET_OVERLOADED_OPERATOR_CODE(NODE, CODE) \
01783 (DECL_LANG_SPECIFIC (NODE)->u.f.operator_code = (CODE))
01784
01785 /* If NODE is an overloaded operator, then this returns the TREE_CODE
01786 associated with the overloaded operator.
01787 DECL_ASSIGNMENT_OPERATOR_P must also be checked to determine
01788 whether or not NODE is an assignment operator. If NODE is not an
01789 overloaded operator, ERROR_MARK is returned. Since the numerical
01790 value of ERROR_MARK is zero, this macro can be used as a predicate
01791 to test whether or not NODE is an overloaded operator. */
01792 #define DECL_OVERLOADED_OPERATOR_P(NODE) \
01793 (IDENTIFIER_OPNAME_P (DECL_NAME (NODE)) \
01794 ? DECL_LANG_SPECIFIC (NODE)->u.f.operator_code : ERROR_MARK)
01795
01796 /* Nonzero if NODE is an assignment operator. */
01797 #define DECL_ASSIGNMENT_OPERATOR_P(NODE) \
01798 (DECL_LANG_SPECIFIC (NODE)->decl_flags.assignment_operator_p)
01799
01800 /* For FUNCTION_DECLs: nonzero means that this function is a
01801 constructor or a destructor with an extra in-charge parameter to
01802 control whether or not virtual bases are constructed. */
01803 #define DECL_HAS_IN_CHARGE_PARM_P(NODE) \
01804 (DECL_LANG_SPECIFIC (NODE)->decl_flags.has_in_charge_parm_p)
01805
01806 /* Nonzero if DECL is a declaration of __builtin_constant_p. */
01807 #define DECL_IS_BUILTIN_CONSTANT_P(NODE) \
01808 (TREE_CODE (NODE) == FUNCTION_DECL \
01809 && DECL_BUILT_IN_CLASS (NODE) == BUILT_IN_NORMAL \
01810 && DECL_FUNCTION_CODE (NODE) == BUILT_IN_CONSTANT_P)
01811
01812 /* Nonzero for _DECL means that this decl appears in (or will appear
01813 in) as a member in a RECORD_TYPE or UNION_TYPE node. It is also for
01814 detecting circularity in case members are multiply defined. In the
01815 case of a VAR_DECL, it is also used to determine how program storage
01816 should be allocated. */
01817 #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE))
01818
01819 /* Nonzero for a VAR_DECL means that the variable's initialization (if
01820 any) has been processed. (In general, DECL_INITIALIZED_P is
01821 !DECL_EXTERN, but static data members may be initialized even if
01822 not defined.) */
01823 #define DECL_INITIALIZED_P(NODE) \
01824 (TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE)))
01825
01826 /* Nonzero for a VAR_DECL iff an explicit initializer was provided. */
01827 #define DECL_NONTRIVIALLY_INITIALIZED_P(NODE) \
01828 (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE)))
01829
01830 /* Nonzero for a VAR_DECL that was initialized with a
01831 constant-expression. */
01832 #define DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P(NODE) \
01833 (TREE_LANG_FLAG_2 (VAR_DECL_CHECK (NODE)))
01834
01835 /* Nonzero for a VAR_DECL that can be used in an integral constant
01836 expression.
01837
01838 [expr.const]
01839
01840 An integral constant-expression can only involve ... const
01841 variables of static or enumeration types initialized with
01842 constant expressions ...
01843
01844 The standard does not require that the expression be non-volatile.
01845 G++ implements the proposed correction in DR 457. */
01846 #define DECL_INTEGRAL_CONSTANT_VAR_P(NODE) \
01847 (TREE_CODE (NODE) == VAR_DECL \
01848 && CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (NODE)) \
01849 && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (NODE)) \
01850 && DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (NODE))
01851
01852 /* Nonzero if the DECL was initialized in the class definition itself,
01853 rather than outside the class. This is used for both static member
01854 VAR_DECLS, and FUNTION_DECLS that are defined in the class. */
01855 #define DECL_INITIALIZED_IN_CLASS_P(DECL) \
01856 (DECL_LANG_SPECIFIC (DECL)->decl_flags.initialized_in_class)
01857
01858 /* Nonzero for DECL means that this decl is just a friend declaration,
01859 and should not be added to the list of members for this class. */
01860 #define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.friend_attr)
01861
01862 /* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */
01863 #define DECL_BEFRIENDING_CLASSES(NODE) \
01864 (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes)
01865
01866 /* Nonzero for FUNCTION_DECL means that this decl is a static
01867 member function. */
01868 #define DECL_STATIC_FUNCTION_P(NODE) \
01869 (DECL_LANG_SPECIFIC (NODE)->decl_flags.static_function)
01870
01871 /* Nonzero for FUNCTION_DECL means that this decl is a non-static
01872 member function. */
01873 #define DECL_NONSTATIC_MEMBER_FUNCTION_P(NODE) \
01874 (TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE)
01875
01876 /* Nonzero for FUNCTION_DECL means that this decl is a member function
01877 (static or non-static). */
01878 #define DECL_FUNCTION_MEMBER_P(NODE) \
01879 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) || DECL_STATIC_FUNCTION_P (NODE))
01880
01881 /* Nonzero for FUNCTION_DECL means that this member function
01882 has `this' as const X *const. */
01883 #define DECL_CONST_MEMFUNC_P(NODE) \
01884 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
01885 && CP_TYPE_CONST_P (TREE_TYPE (TREE_VALUE \
01886 (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
01887
01888 /* Nonzero for FUNCTION_DECL means that this member function
01889 has `this' as volatile X *const. */
01890 #define DECL_VOLATILE_MEMFUNC_P(NODE) \
01891 (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE) \
01892 && CP_TYPE_VOLATILE_P (TREE_TYPE (TREE_VALUE \
01893 (TYPE_ARG_TYPES (TREE_TYPE (NODE))))))
01894
01895 /* Nonzero for a DECL means that this member is a non-static member. */
01896 #define DECL_NONSTATIC_MEMBER_P(NODE) \
01897 ((TREE_CODE (NODE) == FUNCTION_DECL \
01898 && DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)) \
01899 || TREE_CODE (NODE) == FIELD_DECL)
01900
01901 /* Nonzero for _DECL means that this member object type
01902 is mutable. */
01903 #define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE))
01904
01905 /* Nonzero for _DECL means that this constructor is a non-converting
01906 constructor. */
01907 #define DECL_NONCONVERTING_P(NODE) \
01908 (DECL_LANG_SPECIFIC (NODE)->decl_flags.nonconverting)
01909
01910 /* Nonzero for FUNCTION_DECL means that this member function is a pure
01911 virtual function. */
01912 #define DECL_PURE_VIRTUAL_P(NODE) \
01913 (DECL_LANG_SPECIFIC (NODE)->decl_flags.pure_virtual)
01914
01915 /* True (in a FUNCTION_DECL) if NODE is a virtual function that is an
01916 invalid overrider for a function from a base class. Once we have
01917 complained about an invalid overrider we avoid complaining about it
01918 again. */
01919 #define DECL_INVALID_OVERRIDER_P(NODE) \
01920 (DECL_LANG_FLAG_4 (NODE))
01921
01922 /* The thunks associated with NODE, a FUNCTION_DECL. */
01923 #define DECL_THUNKS(NODE) \
01924 (DECL_LANG_SPECIFIC (NODE)->u.f.context)
01925
01926 /* Nonzero if NODE is a thunk, rather than an ordinary function. */
01927 #define DECL_THUNK_P(NODE) \
01928 (TREE_CODE (NODE) == FUNCTION_DECL \
01929 && DECL_LANG_SPECIFIC (NODE) \
01930 && DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p)
01931
01932 /* Set DECL_THUNK_P for node. */
01933 #define SET_DECL_THUNK_P(NODE, THIS_ADJUSTING) \
01934 (DECL_LANG_SPECIFIC (NODE)->decl_flags.thunk_p = 1, \
01935 DECL_LANG_SPECIFIC (NODE)->u.f.u3sel = 1, \
01936 DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p = (THIS_ADJUSTING))
01937
01938 /* Nonzero if NODE is a this pointer adjusting thunk. */
01939 #define DECL_THIS_THUNK_P(NODE) \
01940 (DECL_THUNK_P (NODE) && DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p)
01941
01942 /* Nonzero if NODE is a result pointer adjusting thunk. */
01943 #define DECL_RESULT_THUNK_P(NODE) \
01944 (DECL_THUNK_P (NODE) && !DECL_LANG_SPECIFIC (NODE)->decl_flags.this_thunk_p)
01945
01946 /* Nonzero if NODE is a FUNCTION_DECL, but not a thunk. */
01947 #define DECL_NON_THUNK_FUNCTION_P(NODE) \
01948 (TREE_CODE (NODE) == FUNCTION_DECL && !DECL_THUNK_P (NODE))
01949
01950 /* Nonzero if NODE is `extern "C"'. */
01951 #define DECL_EXTERN_C_P(NODE) \
01952 (DECL_LANGUAGE (NODE) == lang_c)
01953
01954 /* Nonzero if NODE is an `extern "C"' function. */
01955 #define DECL_EXTERN_C_FUNCTION_P(NODE) \
01956 (DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
01957
01958 /* True iff DECL is an entity with vague linkage whose definition is
01959 available in this translation unit. */
01960 #define DECL_REPO_AVAILABLE_P(NODE) \
01961 (DECL_LANG_SPECIFIC (NODE)->decl_flags.repo_available_p)
01962
01963 /* Nonzero if this DECL is the __PRETTY_FUNCTION__ variable in a
01964 template function. */
01965 #define DECL_PRETTY_FUNCTION_P(NODE) \
01966 (TREE_LANG_FLAG_0 (VAR_DECL_CHECK (NODE)))
01967
01968 /* The _TYPE context in which this _DECL appears. This field holds the
01969 class where a virtual function instance is actually defined. */
01970 #define DECL_CLASS_CONTEXT(NODE) \
01971 (DECL_CLASS_SCOPE_P (NODE) ? DECL_CONTEXT (NODE) : NULL_TREE)
01972
01973 /* For a non-member friend function, the class (if any) in which this
01974 friend was defined. For example, given:
01975
01976 struct S { friend void f (); };
01977
01978 the DECL_FRIEND_CONTEXT for `f' will be `S'. */
01979 #define DECL_FRIEND_CONTEXT(NODE) \
01980 ((DECL_FRIEND_P (NODE) && !DECL_FUNCTION_MEMBER_P (NODE)) \
01981 ? DECL_LANG_SPECIFIC (NODE)->u.f.context \
01982 : NULL_TREE)
01983
01984 /* Set the DECL_FRIEND_CONTEXT for NODE to CONTEXT. */
01985 #define SET_DECL_FRIEND_CONTEXT(NODE, CONTEXT) \
01986 (DECL_LANG_SPECIFIC (NODE)->u.f.context = (CONTEXT))
01987
01988 /* NULL_TREE in DECL_CONTEXT represents the global namespace. */
01989 #define CP_DECL_CONTEXT(NODE) \
01990 (DECL_CONTEXT (NODE) ? DECL_CONTEXT (NODE) : global_namespace)
01991 #define CP_TYPE_CONTEXT(NODE) \
01992 (TYPE_CONTEXT (NODE) ? TYPE_CONTEXT (NODE) : global_namespace)
01993 #define FROB_CONTEXT(NODE) ((NODE) == global_namespace ? NULL_TREE : (NODE))
01994
01995 /* 1 iff NODE has namespace scope, including the global namespace. */
01996 #define DECL_NAMESPACE_SCOPE_P(NODE) \
01997 (!DECL_TEMPLATE_PARM_P (NODE) \
01998 && TREE_CODE (CP_DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
01999
02000 #define TYPE_NAMESPACE_SCOPE_P(NODE) \
02001 (TREE_CODE (CP_TYPE_CONTEXT (NODE)) == NAMESPACE_DECL)
02002
02003 /* 1 iff NODE is a class member. */
02004 #define DECL_CLASS_SCOPE_P(NODE) \
02005 (DECL_CONTEXT (NODE) && TYPE_P (DECL_CONTEXT (NODE)))
02006
02007 #define TYPE_CLASS_SCOPE_P(NODE) \
02008 (TYPE_CONTEXT (NODE) && TYPE_P (TYPE_CONTEXT (NODE)))
02009
02010 /* 1 iff NODE is function-local. */
02011 #define DECL_FUNCTION_SCOPE_P(NODE) \
02012 (DECL_CONTEXT (NODE) \
02013 && TREE_CODE (DECL_CONTEXT (NODE)) == FUNCTION_DECL)
02014
02015 #define TYPE_FUNCTION_SCOPE_P(NODE) \
02016 (TYPE_CONTEXT (NODE) \
02017 && TREE_CODE (TYPE_CONTEXT (NODE)) == FUNCTION_DECL)
02018
02019 /* 1 iff VAR_DECL node NODE is a type-info decl. This flag is set for
02020 both the primary typeinfo object and the associated NTBS name. */
02021 #define DECL_TINFO_P(NODE) TREE_LANG_FLAG_4 (VAR_DECL_CHECK (NODE))
02022
02023 /* 1 iff VAR_DECL node NODE is virtual table or VTT. */
02024 #define DECL_VTABLE_OR_VTT_P(NODE) TREE_LANG_FLAG_5 (VAR_DECL_CHECK (NODE))
02025
02026 /* Returns 1 iff VAR_DECL is a construction virtual table.
02027 DECL_VTABLE_OR_VTT_P will be true in this case and must be checked
02028 before using this macro. */
02029 #define DECL_CONSTRUCTION_VTABLE_P(NODE) \
02030 TREE_LANG_FLAG_6 (VAR_DECL_CHECK (NODE))
02031
02032 /* 1 iff NODE is function-local, but for types. */
02033 #define LOCAL_CLASS_P(NODE) \
02034 (decl_function_context (TYPE_MAIN_DECL (NODE)) != NULL_TREE)
02035
02036 /* For a NAMESPACE_DECL: the list of using namespace directives
02037 The PURPOSE is the used namespace, the value is the namespace
02038 that is the common ancestor. */
02039 #define DECL_NAMESPACE_USING(NODE) DECL_VINDEX (NAMESPACE_DECL_CHECK (NODE))
02040
02041 /* In a NAMESPACE_DECL, the DECL_INITIAL is used to record all users
02042 of a namespace, to record the transitive closure of using namespace. */
02043 #define DECL_NAMESPACE_USERS(NODE) DECL_INITIAL (NAMESPACE_DECL_CHECK (NODE))
02044
02045 /* In a NAMESPACE_DECL, the list of namespaces which have associated
02046 themselves with this one. */
02047 #define DECL_NAMESPACE_ASSOCIATIONS(NODE) \
02048 (NAMESPACE_DECL_CHECK (NODE)->decl_non_common.saved_tree)
02049
02050 /* In a NAMESPACE_DECL, points to the original namespace if this is
02051 a namespace alias. */
02052 #define DECL_NAMESPACE_ALIAS(NODE) \
02053 DECL_ABSTRACT_ORIGIN (NAMESPACE_DECL_CHECK (NODE))
02054 #define ORIGINAL_NAMESPACE(NODE) \
02055 (DECL_NAMESPACE_ALIAS (NODE) ? DECL_NAMESPACE_ALIAS (NODE) : (NODE))
02056
02057 /* Nonzero if NODE is the std namespace. */
02058 #define DECL_NAMESPACE_STD_P(NODE) \
02059 (TREE_CODE (NODE) == NAMESPACE_DECL \
02060 && CP_DECL_CONTEXT (NODE) == global_namespace \
02061 && DECL_NAME (NODE) == std_identifier)
02062
02063 /* In a TREE_LIST concatenating using directives, indicate indirect
02064 directives */
02065 #define TREE_INDIRECT_USING(NODE) (TREE_LIST_CHECK (NODE)->common.lang_flag_0)
02066
02067 extern tree decl_shadowed_for_var_lookup (tree);
02068 extern void decl_shadowed_for_var_insert (tree, tree);
02069
02070 /* Non zero if this is a using decl for a dependent scope. */
02071 #define DECL_DEPENDENT_P(NODE) DECL_LANG_FLAG_0 (USING_DECL_CHECK (NODE))
02072
02073 /* The scope named in a using decl. */
02074 #define USING_DECL_SCOPE(NODE) TREE_TYPE (USING_DECL_CHECK (NODE))
02075
02076 /* The decls named by a using decl. */
02077 #define USING_DECL_DECLS(NODE) DECL_INITIAL (USING_DECL_CHECK (NODE))
02078
02079 /* In a VAR_DECL, true if we have a shadowed local variable
02080 in the shadowed var table for this VAR_DECL. */
02081 #define DECL_HAS_SHADOWED_FOR_VAR_P(NODE) \
02082 (VAR_DECL_CHECK (NODE)->decl_with_vis.shadowed_for_var_p)
02083
02084 /* In a VAR_DECL for a variable declared in a for statement,
02085 this is the shadowed (local) variable. */
02086 #define DECL_SHADOWED_FOR_VAR(NODE) \
02087 (DECL_HAS_SHADOWED_FOR_VAR_P(NODE) ? decl_shadowed_for_var_lookup (NODE) : NULL)
02088
02089 #define SET_DECL_SHADOWED_FOR_VAR(NODE, VAL) \
02090 (decl_shadowed_for_var_insert (NODE, VAL))
02091
02092 /* In a FUNCTION_DECL, this is nonzero if this function was defined in
02093 the class definition. We have saved away the text of the function,
02094 but have not yet processed it. */
02095 #define DECL_PENDING_INLINE_P(NODE) \
02096 (DECL_LANG_SPECIFIC (NODE)->u.f.pending_inline_p)
02097
02098 /* If DECL_PENDING_INLINE_P holds, this is the saved text of the
02099 function. */
02100 #define DECL_PENDING_INLINE_INFO(NODE) \
02101 (DECL_LANG_SPECIFIC (NODE)->u.f.u.pending_inline_info)
02102
02103 /* For a TYPE_DECL: if this structure has many fields, we'll sort them
02104 and put them into a TREE_VEC. */
02105 #define DECL_SORTED_FIELDS(NODE) \
02106 (DECL_LANG_SPECIFIC (TYPE_DECL_CHECK (NODE))->u.f.u.sorted_fields)
02107
02108 /* True if on the deferred_fns (see decl2.c) list. */
02109 #define DECL_DEFERRED_FN(DECL) \
02110 (DECL_LANG_SPECIFIC (DECL)->decl_flags.deferred)
02111
02112 /* If non-NULL for a VAR_DECL, FUNCTION_DECL, TYPE_DECL or
02113 TEMPLATE_DECL, the entity is either a template specialization (if
02114 DECL_USE_TEMPLATE is non-zero) or the abstract instance of the
02115 template itself.
02116
02117 In either case, DECL_TEMPLATE_INFO is a TREE_LIST, whose
02118 TREE_PURPOSE is the TEMPLATE_DECL of which this entity is a
02119 specialization or abstract instance. The TREE_VALUE is the
02120 template arguments used to specialize the template.
02121
02122 Consider:
02123
02124 template <typename T> struct S { friend void f(T) {} };
02125
02126 In this case, S<int>::f is, from the point of view of the compiler,
02127 an instantiation of a template -- but, from the point of view of
02128 the language, each instantiation of S results in a wholly unrelated
02129 global function f. In this case, DECL_TEMPLATE_INFO for S<int>::f
02130 will be non-NULL, but DECL_USE_TEMPLATE will be zero. */
02131 #define DECL_TEMPLATE_INFO(NODE) \
02132 (DECL_LANG_SPECIFIC (VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE)) \
02133 ->decl_flags.u.template_info)
02134
02135 /* For a VAR_DECL, indicates that the variable has been processed.
02136 This flag is set and unset throughout the code; it is always
02137 used for a temporary purpose. */
02138 #define DECL_VAR_MARKED_P(NODE) \
02139 (DECL_LANG_FLAG_4 (VAR_DECL_CHECK (NODE)))
02140
02141 /* Template information for a RECORD_TYPE or UNION_TYPE. */
02142 #define CLASSTYPE_TEMPLATE_INFO(NODE) \
02143 (LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_CHECK (NODE))->template_info)
02144
02145 /* Template information for an ENUMERAL_TYPE. Although an enumeration may
02146 not be a primary template, it may be declared within the scope of a
02147 primary template and the enumeration constants may depend on
02148 non-type template parameters. */
02149 #define ENUM_TEMPLATE_INFO(NODE) \
02150 (TYPE_LANG_SLOT_1 (ENUMERAL_TYPE_CHECK (NODE)))
02151
02152 /* Template information for a template template parameter. */
02153 #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \
02154 (LANG_TYPE_CLASS_CHECK (BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK (NODE)) \
02155 ->template_info)
02156
02157 /* Template information for an ENUMERAL_, RECORD_, or UNION_TYPE. */
02158 #define TYPE_TEMPLATE_INFO(NODE) \
02159 (TREE_CODE (NODE) == ENUMERAL_TYPE \
02160 ? ENUM_TEMPLATE_INFO (NODE) : \
02161 (TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM \
02162 ? TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (NODE) : \
02163 (TYPE_LANG_SPECIFIC (NODE) \
02164 ? CLASSTYPE_TEMPLATE_INFO (NODE) \
02165 : NULL_TREE)))
02166
02167 /* Set the template information for an ENUMERAL_, RECORD_, or
02168 UNION_TYPE to VAL. */
02169 #define SET_TYPE_TEMPLATE_INFO(NODE, VAL) \
02170 (TREE_CODE (NODE) == ENUMERAL_TYPE \
02171 ? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \
02172 : (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)))
02173
02174 #define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
02175 #define TI_ARGS(NODE) (TREE_VALUE (NODE))
02176 #define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
02177
02178 /* We use TREE_VECs to hold template arguments. If there is only one
02179 level of template arguments, then the TREE_VEC contains the
02180 arguments directly. If there is more than one level of template
02181 arguments, then each entry in the TREE_VEC is itself a TREE_VEC,
02182 containing the template arguments for a single level. The first
02183 entry in the outer TREE_VEC is the outermost level of template
02184 parameters; the last is the innermost.
02185
02186 It is incorrect to ever form a template argument vector containing
02187 only one level of arguments, but which is a TREE_VEC containing as
02188 its only entry the TREE_VEC for that level. */
02189
02190 /* Nonzero if the template arguments is actually a vector of vectors,
02191 rather than just a vector. */
02192 #define TMPL_ARGS_HAVE_MULTIPLE_LEVELS(NODE) \
02193 (NODE && TREE_VEC_ELT (NODE, 0) \
02194 && TREE_CODE (TREE_VEC_ELT (NODE, 0)) == TREE_VEC)
02195
02196 /* The depth of a template argument vector. When called directly by
02197 the parser, we use a TREE_LIST rather than a TREE_VEC to represent
02198 template arguments. In fact, we may even see NULL_TREE if there
02199 are no template arguments. In both of those cases, there is only
02200 one level of template arguments. */
02201 #define TMPL_ARGS_DEPTH(NODE) \
02202 (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (NODE) ? TREE_VEC_LENGTH (NODE) : 1)
02203
02204 /* The LEVELth level of the template ARGS. The outermost level of
02205 args is level 1, not level 0. */
02206 #define TMPL_ARGS_LEVEL(ARGS, LEVEL) \
02207 (TMPL_ARGS_HAVE_MULTIPLE_LEVELS (ARGS) \
02208 ? TREE_VEC_ELT (ARGS, (LEVEL) - 1) : (ARGS))
02209
02210 /* Set the LEVELth level of the template ARGS to VAL. This macro does
02211 not work with single-level argument vectors. */
02212 #define SET_TMPL_ARGS_LEVEL(ARGS, LEVEL, VAL) \
02213 (TREE_VEC_ELT (ARGS, (LEVEL) - 1) = (VAL))
02214
02215 /* Accesses the IDXth parameter in the LEVELth level of the ARGS. */
02216 #define TMPL_ARG(ARGS, LEVEL, IDX) \
02217 (TREE_VEC_ELT (TMPL_ARGS_LEVEL (ARGS, LEVEL), IDX))
02218
02219 /* Given a single level of template arguments in NODE, return the
02220 number of arguments. */
02221 #define NUM_TMPL_ARGS(NODE) \
02222 (TREE_VEC_LENGTH (NODE))
02223
02224 /* Returns the innermost level of template arguments in ARGS. */
02225 #define INNERMOST_TEMPLATE_ARGS(NODE) \
02226 (get_innermost_template_args ((NODE), 1))
02227
02228 /* The number of levels of template parameters given by NODE. */
02229 #define TMPL_PARMS_DEPTH(NODE) \
02230 ((HOST_WIDE_INT) TREE_INT_CST_LOW (TREE_PURPOSE (NODE)))
02231
02232 /* The TEMPLATE_DECL instantiated or specialized by NODE. This
02233 TEMPLATE_DECL will be the immediate parent, not the most general
02234 template. For example, in:
02235
02236 template <class T> struct S { template <class U> void f(U); }
02237
02238 the FUNCTION_DECL for S<int>::f<double> will have, as its
02239 DECL_TI_TEMPLATE, `template <class U> S<int>::f<U>'.
02240
02241 As a special case, for a member friend template of a template
02242 class, this value will not be a TEMPLATE_DECL, but rather an
02243 IDENTIFIER_NODE or OVERLOAD indicating the name of the template and
02244 any explicit template arguments provided. For example, in:
02245
02246 template <class T> struct S { friend void f<int>(int, double); }
02247
02248 the DECL_TI_TEMPLATE will be an IDENTIFIER_NODE for `f' and the
02249 DECL_TI_ARGS will be {int}. */
02250 #define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
02251
02252 /* The template arguments used to obtain this decl from the most
02253 general form of DECL_TI_TEMPLATE. For the example given for
02254 DECL_TI_TEMPLATE, the DECL_TI_ARGS will be {int, double}. These
02255 are always the full set of arguments required to instantiate this
02256 declaration from the most general template specialized here. */
02257 #define DECL_TI_ARGS(NODE) TI_ARGS (DECL_TEMPLATE_INFO (NODE))
02258
02259 /* The TEMPLATE_DECL associated with NODE, a class type. Even if NODE
02260 will be generated from a partial specialization, the TEMPLATE_DECL
02261 referred to here will be the original template. For example,
02262 given:
02263
02264 template <typename T> struct S {};
02265 template <typename T> struct S<T*> {};
02266
02267 the CLASSTPYE_TI_TEMPLATE for S<int*> will be S, not the S<T*>. */
02268 #define CLASSTYPE_TI_TEMPLATE(NODE) TI_TEMPLATE (CLASSTYPE_TEMPLATE_INFO (NODE))
02269 #define CLASSTYPE_TI_ARGS(NODE) TI_ARGS (CLASSTYPE_TEMPLATE_INFO (NODE))
02270
02271 /* For a template instantiation TYPE, returns the TYPE corresponding
02272 to the primary template. Otherwise returns TYPE itself. */
02273 #define CLASSTYPE_PRIMARY_TEMPLATE_TYPE(TYPE) \
02274 ((CLASSTYPE_USE_TEMPLATE ((TYPE)) \
02275 && !CLASSTYPE_TEMPLATE_SPECIALIZATION ((TYPE))) \
02276 ? TREE_TYPE (DECL_TEMPLATE_RESULT (DECL_PRIMARY_TEMPLATE \
02277 (CLASSTYPE_TI_TEMPLATE ((TYPE))))) \
02278 : (TYPE))
02279
02280 /* Like CLASS_TI_TEMPLATE, but also works for ENUMERAL_TYPEs. */
02281 #define TYPE_TI_TEMPLATE(NODE) \
02282 (TI_TEMPLATE (TYPE_TEMPLATE_INFO (NODE)))
02283
02284 /* Like DECL_TI_ARGS, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
02285 #define TYPE_TI_ARGS(NODE) \
02286 (TI_ARGS (TYPE_TEMPLATE_INFO (NODE)))
02287
02288 #define INNERMOST_TEMPLATE_PARMS(NODE) TREE_VALUE (NODE)
02289
02290 /* Nonzero if NODE (a TEMPLATE_DECL) is a member template, in the
02291 sense of [temp.mem]. */
02292 #define DECL_MEMBER_TEMPLATE_P(NODE) \
02293 (DECL_LANG_FLAG_1 (TEMPLATE_DECL_CHECK (NODE)))
02294
02295 /* Nonzero if the NODE corresponds to the template parameters for a
02296 member template, whose inline definition is being processed after
02297 the class definition is complete. */
02298 #define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
02299
02300 /* In a FUNCTION_DECL, the saved language-specific per-function data. */
02301 #define DECL_SAVED_FUNCTION_DATA(NODE) \
02302 (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (NODE)) \
02303 ->u.f.u.saved_language_function)
02304
02305 /* Indicates an indirect_expr is for converting a reference. */
02306 #define REFERENCE_REF_P(NODE) \
02307 TREE_LANG_FLAG_0 (INDIRECT_REF_CHECK (NODE))
02308
02309 #define NEW_EXPR_USE_GLOBAL(NODE) \
02310 TREE_LANG_FLAG_0 (NEW_EXPR_CHECK (NODE))
02311 #define DELETE_EXPR_USE_GLOBAL(NODE) \
02312 TREE_LANG_FLAG_0 (DELETE_EXPR_CHECK (NODE))
02313 #define DELETE_EXPR_USE_VEC(NODE) \
02314 TREE_LANG_FLAG_1 (DELETE_EXPR_CHECK (NODE))
02315
02316 /* Indicates that this is a non-dependent COMPOUND_EXPR which will
02317 resolve to a function call. */
02318 #define COMPOUND_EXPR_OVERLOADED(NODE) \
02319 TREE_LANG_FLAG_0 (COMPOUND_EXPR_CHECK (NODE))
02320
02321 /* In a CALL_EXPR appearing in a template, true if Koenig lookup
02322 should be performed at instantiation time. */
02323 #define KOENIG_LOOKUP_P(NODE) TREE_LANG_FLAG_0 (CALL_EXPR_CHECK (NODE))
02324
02325 /* Indicates whether a string literal has been parenthesized. Such
02326 usages are disallowed in certain circumstances. */
02327
02328 #define PAREN_STRING_LITERAL_P(NODE) \
02329 TREE_LANG_FLAG_0 (STRING_CST_CHECK (NODE))
02330
02331 /* Nonzero if this AGGR_INIT_EXPR provides for initialization via a
02332 constructor call, rather than an ordinary function call. */
02333 #define AGGR_INIT_VIA_CTOR_P(NODE) \
02334 TREE_LANG_FLAG_0 (AGGR_INIT_EXPR_CHECK (NODE))
02335
02336 /* The TYPE_MAIN_DECL for a class template type is a TYPE_DECL, not a
02337 TEMPLATE_DECL. This macro determines whether or not a given class
02338 type is really a template type, as opposed to an instantiation or
02339 specialization of one. */
02340 #define CLASSTYPE_IS_TEMPLATE(NODE) \
02341 (CLASSTYPE_TEMPLATE_INFO (NODE) \
02342 && !CLASSTYPE_USE_TEMPLATE (NODE) \
02343 && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (NODE)))
02344
02345 /* The name used by the user to name the typename type. Typically,
02346 this is an IDENTIFIER_NODE, and the same as the DECL_NAME on the
02347 corresponding TYPE_DECL. However, this may also be a
02348 TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
02349 #define TYPENAME_TYPE_FULLNAME(NODE) (TYPENAME_TYPE_CHECK (NODE))->type.values
02350
02351 /* True if a TYPENAME_TYPE was declared as an "enum". */
02352 #define TYPENAME_IS_ENUM_P(NODE) \
02353 (TREE_LANG_FLAG_0 (TYPENAME_TYPE_CHECK (NODE)))
02354
02355 /* True if a TYPENAME_TYPE was declared as a "class", "struct", or
02356 "union". */
02357 #define TYPENAME_IS_CLASS_P(NODE) \
02358 (TREE_LANG_FLAG_1 (TYPENAME_TYPE_CHECK (NODE)))
02359
02360 /* Nonzero in INTEGER_CST means that this int is negative by dint of
02361 using a twos-complement negated operand. */
02362 #define TREE_NEGATED_INT(NODE) TREE_LANG_FLAG_0 (INTEGER_CST_CHECK (NODE))
02363
02364 /* [class.virtual]
02365
02366 A class that declares or inherits a virtual function is called a
02367 polymorphic class. */
02368 #define TYPE_POLYMORPHIC_P(NODE) (TREE_LANG_FLAG_2 (NODE))
02369
02370 /* Nonzero if this class has a virtual function table pointer. */
02371 #define TYPE_CONTAINS_VPTR_P(NODE) \
02372 (TYPE_POLYMORPHIC_P (NODE) || CLASSTYPE_VBASECLASSES (NODE))
02373
02374 /* This flag is true of a local VAR_DECL if it was declared in a for
02375 statement, but we are no longer in the scope of the for. */
02376 #define DECL_DEAD_FOR_LOCAL(NODE) DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE))
02377
02378 /* This flag is set on a VAR_DECL that is a DECL_DEAD_FOR_LOCAL
02379 if we already emitted a warning about using it. */
02380 #define DECL_ERROR_REPORTED(NODE) DECL_LANG_FLAG_0 (VAR_DECL_CHECK (NODE))
02381
02382 /* Nonzero if NODE is a FUNCTION_DECL (for a function with global
02383 scope) declared in a local scope. */
02384 #define DECL_LOCAL_FUNCTION_P(NODE) \
02385 DECL_LANG_FLAG_0 (FUNCTION_DECL_CHECK (NODE))
02386
02387 /* Nonzero if NODE is a DECL which we know about but which has not
02388 been explicitly declared, such as a built-in function or a friend
02389 declared inside a class. In the latter case DECL_HIDDEN_FRIEND_P
02390 will be set. */
02391 #define DECL_ANTICIPATED(NODE) \
02392 (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->decl_flags.anticipated_p)
02393
02394 /* Nonzero if NODE is a FUNCTION_DECL which was declared as a friend
02395 within a class but has not been declared in the surrounding scope.
02396 The function is invisible except via argument dependent lookup. */
02397 #define DECL_HIDDEN_FRIEND_P(NODE) \
02398 (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->decl_flags.hidden_friend_p)
02399
02400 /* Nonzero if DECL has been declared threadprivate by
02401 #pragma omp threadprivate. */
02402 #define CP_DECL_THREADPRIVATE_P(DECL) \
02403 (DECL_LANG_SPECIFIC (VAR_DECL_CHECK (DECL))->decl_flags.threadprivate_p)
02404
02405 /* Record whether a typedef for type `int' was actually `signed int'. */
02406 #define C_TYPEDEF_EXPLICITLY_SIGNED(EXP) DECL_LANG_FLAG_1 (EXP)
02407
02408 /* Returns nonzero if DECL has external linkage, as specified by the
02409 language standard. (This predicate may hold even when the
02410 corresponding entity is not actually given external linkage in the
02411 object file; see decl_linkage for details.) */
02412 #define DECL_EXTERNAL_LINKAGE_P(DECL) \
02413 (decl_linkage (DECL) == lk_external)
02414
02415 /* Keep these codes in ascending code order. */
02416
02417 #define INTEGRAL_CODE_P(CODE) \
02418 ((CODE) == ENUMERAL_TYPE \
02419 || (CODE) == BOOLEAN_TYPE \
02420 || (CODE) == INTEGER_TYPE)
02421
02422 /* [basic.fundamental]
02423
02424 Types bool, char, wchar_t, and the signed and unsigned integer types
02425 are collectively called integral types.
02426
02427 Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
02428 types as well, which is incorrect in C++. Keep these checks in
02429 ascending code order. */
02430 #define CP_INTEGRAL_TYPE_P(TYPE) \
02431 (TREE_CODE (TYPE) == BOOLEAN_TYPE \
02432 || TREE_CODE (TYPE) == INTEGER_TYPE)
02433
02434 /* Returns true if TYPE is an integral or enumeration name. Keep
02435 these checks in ascending code order. */
02436 #define INTEGRAL_OR_ENUMERATION_TYPE_P(TYPE) \
02437 (TREE_CODE (TYPE) == ENUMERAL_TYPE || CP_INTEGRAL_TYPE_P (TYPE))
02438
02439 /* [basic.fundamental]
02440
02441 Integral and floating types are collectively called arithmetic
02442 types. Keep these checks in ascending code order. */
02443 #define ARITHMETIC_TYPE_P(TYPE) \
02444 (CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE)
02445
02446 /* [basic.types]
02447
02448 Arithmetic types, enumeration types, pointer types, and
02449 pointer-to-member types, are collectively called scalar types.
02450 Keep these checks in ascending code order. */
02451 #define SCALAR_TYPE_P(TYPE) \
02452 (TYPE_PTRMEM_P (TYPE) \
02453 || TREE_CODE (TYPE) == ENUMERAL_TYPE \
02454 || ARITHMETIC_TYPE_P (TYPE) \
02455 || TYPE_PTR_P (TYPE) \
02456 || TYPE_PTRMEMFUNC_P (TYPE))
02457
02458 /* [dcl.init.aggr]
02459
02460 An aggregate is an array or a class with no user-declared
02461 constructors, no private or protected non-static data members, no
02462 base classes, and no virtual functions.
02463
02464 As an extension, we also treat vectors as aggregates. Keep these
02465 checks in ascending code order. */
02466 #define CP_AGGREGATE_TYPE_P(TYPE) \
02467 (TREE_CODE (TYPE) == VECTOR_TYPE \
02468 ||TREE_CODE (TYPE) == ARRAY_TYPE \
02469 || (CLASS_TYPE_P (TYPE) && !CLASSTYPE_NON_AGGREGATE (TYPE)))
02470
02471 /* Nonzero for a class type means that the class type has a
02472 user-declared constructor. */
02473 #define TYPE_HAS_CONSTRUCTOR(NODE) (TYPE_LANG_FLAG_1 (NODE))
02474
02475 /* When appearing in an INDIRECT_REF, it means that the tree structure
02476 underneath is actually a call to a constructor. This is needed
02477 when the constructor must initialize local storage (which can
02478 be automatically destroyed), rather than allowing it to allocate
02479 space from the heap.
02480
02481 When appearing in a SAVE_EXPR, it means that underneath
02482 is a call to a constructor.
02483
02484 When appearing in a CONSTRUCTOR, the expression is a
02485 compound literal.
02486
02487 When appearing in a FIELD_DECL, it means that this field
02488 has been duly initialized in its constructor. */
02489 #define TREE_HAS_CONSTRUCTOR(NODE) (TREE_LANG_FLAG_4 (NODE))
02490
02491 /* True if NODE is a brace-enclosed initializer. */
02492 #define BRACE_ENCLOSED_INITIALIZER_P(NODE) \
02493 (TREE_CODE (NODE) == CONSTRUCTOR && !TREE_TYPE (NODE))
02494
02495 /* True if NODE is a compound-literal, i.e., a brace-enclosed
02496 initializer cast to a particular type. */
02497 #define COMPOUND_LITERAL_P(NODE) \
02498 (TREE_CODE (NODE) == CONSTRUCTOR && TREE_HAS_CONSTRUCTOR (NODE))
02499
02500 #define EMPTY_CONSTRUCTOR_P(NODE) (TREE_CODE (NODE) == CONSTRUCTOR \
02501 && VEC_empty (constructor_elt, \
02502 CONSTRUCTOR_ELTS (NODE)) \
02503 && !TREE_HAS_CONSTRUCTOR (NODE))
02504
02505 /* Nonzero means that an object of this type can not be initialized using
02506 an initializer list. */
02507 #define CLASSTYPE_NON_AGGREGATE(NODE) \
02508 (LANG_TYPE_CLASS_CHECK (NODE)->non_aggregate)
02509 #define TYPE_NON_AGGREGATE_CLASS(NODE) \
02510 (IS_AGGR_TYPE (NODE) && CLASSTYPE_NON_AGGREGATE (NODE))
02511
02512 /* Nonzero if there is a user-defined X::op=(x&) for this class. */
02513 #define TYPE_HAS_COMPLEX_ASSIGN_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_assign_ref)
02514 #define TYPE_HAS_COMPLEX_INIT_REF(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->has_complex_init_ref)
02515
02516 /* Nonzero if TYPE has a trivial destructor. From [class.dtor]:
02517
02518 A destructor is trivial if it is an implicitly declared
02519 destructor and if:
02520
02521 - all of the direct base classes of its class have trivial
02522 destructors,
02523
02524 - for all of the non-static data members of its class that are
02525 of class type (or array thereof), each such class has a
02526 trivial destructor. */
02527 #define TYPE_HAS_TRIVIAL_DESTRUCTOR(NODE) \
02528 (!TYPE_HAS_NONTRIVIAL_DESTRUCTOR (NODE))
02529
02530 /* Nonzero for _TYPE node means that this type does not have a trivial
02531 destructor. Therefore, destroying an object of this type will
02532 involve a call to a destructor. This can apply to objects of
02533 ARRAY_TYPE is the type of the elements needs a destructor. */
02534 #define TYPE_HAS_NONTRIVIAL_DESTRUCTOR(NODE) \
02535 (TYPE_LANG_FLAG_4 (NODE))
02536
02537 /* Nonzero for class type means that copy initialization of this type can use
02538 a bitwise copy. */
02539 #define TYPE_HAS_TRIVIAL_INIT_REF(NODE) \
02540 (TYPE_HAS_INIT_REF (NODE) && ! TYPE_HAS_COMPLEX_INIT_REF (NODE))
02541
02542 /* Nonzero for class type means that assignment of this type can use
02543 a bitwise copy. */
02544 #define TYPE_HAS_TRIVIAL_ASSIGN_REF(NODE) \
02545 (TYPE_HAS_ASSIGN_REF (NODE) && ! TYPE_HAS_COMPLEX_ASSIGN_REF (NODE))
02546
02547 /* Returns true if NODE is a pointer-to-data-member. */
02548 #define TYPE_PTRMEM_P(NODE) \
02549 (TREE_CODE (NODE) == OFFSET_TYPE)
02550 /* Returns true if NODE is a pointer. */
02551 #define TYPE_PTR_P(NODE) \
02552 (TREE_CODE (NODE) == POINTER_TYPE)
02553
02554 /* Returns true if NODE is an object type:
02555
02556 [basic.types]
02557
02558 An object type is a (possibly cv-qualified) type that is not a
02559 function type, not a reference type, and not a void type.
02560
02561 Keep these checks in ascending order, for speed. */
02562 #define TYPE_OBJ_P(NODE) \
02563 (TREE_CODE (NODE) != REFERENCE_TYPE \
02564 && TREE_CODE (NODE) != VOID_TYPE \
02565 && TREE_CODE (NODE) != FUNCTION_TYPE \
02566 && TREE_CODE (NODE) != METHOD_TYPE)
02567
02568 /* Returns true if NODE is a pointer to an object. Keep these checks
02569 in ascending tree code order. */
02570 #define TYPE_PTROB_P(NODE) \
02571 (TYPE_PTR_P (NODE) && TYPE_OBJ_P (TREE_TYPE (NODE)))
02572
02573 /* Returns true if NODE is a reference to an object. Keep these checks
02574 in ascending tree code order. */
02575 #define TYPE_REF_OBJ_P(NODE) \
02576 (TREE_CODE (NODE) == REFERENCE_TYPE && TYPE_OBJ_P (TREE_TYPE (NODE)))
02577
02578 /* Returns true if NODE is a pointer to an object, or a pointer to
02579 void. Keep these checks in ascending tree code order. */
02580 #define TYPE_PTROBV_P(NODE) \
02581 (TYPE_PTR_P (NODE) \
02582 && !(TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE \
02583 || TREE_CODE (TREE_TYPE (NODE)) == METHOD_TYPE))
02584
02585 /* Returns true if NODE is a pointer to function. */
02586 #define TYPE_PTRFN_P(NODE) \
02587 (TREE_CODE (NODE) == POINTER_TYPE \
02588 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
02589
02590 /* Returns true if NODE is a reference to function. */
02591 #define TYPE_REFFN_P(NODE) \
02592 (TREE_CODE (NODE) == REFERENCE_TYPE \
02593 && TREE_CODE (TREE_TYPE (NODE)) == FUNCTION_TYPE)
02594
02595 /* Nonzero for _TYPE node means that this type is a pointer to member
02596 function type. */
02597 #define TYPE_PTRMEMFUNC_P(NODE) \
02598 (TREE_CODE (NODE) == RECORD_TYPE \
02599 && TYPE_LANG_SPECIFIC (NODE) \
02600 && TYPE_PTRMEMFUNC_FLAG (NODE))
02601
02602 #define TYPE_PTRMEMFUNC_FLAG(NODE) \
02603 (LANG_TYPE_CLASS_CHECK (NODE)->ptrmemfunc_flag)
02604
02605 /* Returns true if NODE is a pointer-to-member. */
02606 #define TYPE_PTR_TO_MEMBER_P(NODE) \
02607 (TYPE_PTRMEM_P (NODE) || TYPE_PTRMEMFUNC_P (NODE))
02608
02609 /* Indicates when overload resolution may resolve to a pointer to
02610 member function. [expr.unary.op]/3 */
02611 #define PTRMEM_OK_P(NODE) \
02612 TREE_LANG_FLAG_0 (TREE_CHECK2 ((NODE), ADDR_EXPR, OFFSET_REF))
02613
02614 /* Get the POINTER_TYPE to the METHOD_TYPE associated with this
02615 pointer to member function. TYPE_PTRMEMFUNC_P _must_ be true,
02616 before using this macro. */
02617 #define TYPE_PTRMEMFUNC_FN_TYPE(NODE) \
02618 (TREE_TYPE (TYPE_FIELDS (NODE)))
02619
02620 /* Returns `A' for a type like `int (A::*)(double)' */
02621 #define TYPE_PTRMEMFUNC_OBJECT_TYPE(NODE) \
02622 TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
02623
02624 /* These are use to manipulate the canonical RECORD_TYPE from the
02625 hashed POINTER_TYPE, and can only be used on the POINTER_TYPE. */
02626 #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) \
02627 (TYPE_LANG_SPECIFIC (NODE) ? LANG_TYPE_PTRMEM_CHECK (NODE)->record : NULL)
02628 #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) \
02629 do { \
02630 if (TYPE_LANG_SPECIFIC (NODE) == NULL) \
02631 { \
02632 TYPE_LANG_SPECIFIC (NODE) = GGC_CNEWVAR \
02633 (struct lang_type, sizeof (struct lang_type_ptrmem)); \
02634 TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.h.is_lang_type_class = 0; \
02635 } \
02636 TYPE_LANG_SPECIFIC (NODE)->u.ptrmem.record = (VALUE); \
02637 } while (0)
02638
02639 /* For a pointer-to-member type of the form `T X::*', this is `X'.
02640 For a type like `void (X::*)() const', this type is `X', not `const
02641 X'. To get at the `const X' you have to look at the
02642 TYPE_PTRMEM_POINTED_TO_TYPE; there, the first parameter will have
02643 type `const X*'. */
02644 #define TYPE_PTRMEM_CLASS_TYPE(NODE) \
02645 (TYPE_PTRMEM_P (NODE) \
02646 ? TYPE_OFFSET_BASETYPE (NODE) \
02647 : TYPE_PTRMEMFUNC_OBJECT_TYPE (NODE))
02648
02649 /* For a pointer-to-member type of the form `T X::*', this is `T'. */
02650 #define TYPE_PTRMEM_POINTED_TO_TYPE(NODE) \
02651 (TYPE_PTRMEM_P (NODE) \
02652 ? TREE_TYPE (NODE) \
02653 : TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (NODE)))
02654
02655 /* For a pointer-to-member constant `X::Y' this is the RECORD_TYPE for
02656 `X'. */
02657 #define PTRMEM_CST_CLASS(NODE) \
02658 TYPE_PTRMEM_CLASS_TYPE (TREE_TYPE (PTRMEM_CST_CHECK (NODE)))
02659
02660 /* For a pointer-to-member constant `X::Y' this is the _DECL for
02661 `Y'. */
02662 #define PTRMEM_CST_MEMBER(NODE) (((ptrmem_cst_t)PTRMEM_CST_CHECK (NODE))->member)
02663
02664 /* The expression in question for a TYPEOF_TYPE. */
02665 #define TYPEOF_TYPE_EXPR(NODE) (TYPEOF_TYPE_CHECK (NODE))->type.values
02666
02667 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was
02668 specified in its declaration. This can also be set for an
02669 erroneously declared PARM_DECL. */
02670 #define DECL_THIS_EXTERN(NODE) \
02671 DECL_LANG_FLAG_2 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
02672
02673 /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `static' was
02674 specified in its declaration. This can also be set for an
02675 erroneously declared PARM_DECL. */
02676 #define DECL_THIS_STATIC(NODE) \
02677 DECL_LANG_FLAG_6 (VAR_FUNCTION_OR_PARM_DECL_CHECK (NODE))
02678
02679 /* Nonzero for FIELD_DECL node means that this field is a base class
02680 of the parent object, as opposed to a member field. */
02681 #define DECL_FIELD_IS_BASE(NODE) \
02682 DECL_LANG_FLAG_6 (FIELD_DECL_CHECK (NODE))
02683
02684 /* Nonzero if TYPE is an anonymous union or struct type. We have to use a
02685 flag for this because "A union for which objects or pointers are
02686 declared is not an anonymous union" [class.union]. */
02687 #define ANON_AGGR_TYPE_P(NODE) \
02688 (CLASS_TYPE_P (NODE) && LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr)
02689 #define SET_ANON_AGGR_TYPE_P(NODE) \
02690 (LANG_TYPE_CLASS_CHECK (NODE)->anon_aggr = 1)
02691
02692 /* Nonzero if TYPE is an anonymous union type. */
02693 #define ANON_UNION_TYPE_P(NODE) \
02694 (TREE_CODE (NODE) == UNION_TYPE && ANON_AGGR_TYPE_P (NODE))
02695
02696 #define UNKNOWN_TYPE LANG_TYPE
02697
02698 /* Define fields and accessors for nodes representing declared names. */
02699
02700 #define TYPE_WAS_ANONYMOUS(NODE) (LANG_TYPE_CLASS_CHECK (NODE)->was_anonymous)
02701
02702 #ifdef KEY
02703 /* Nonzero means this type's copy constructor is implicitly defined instead of
02704 user defined. */
02705 #define TYPE_HAS_IMPLICIT_COPY_CONSTRUCTOR(NODE) \
02706 (LANG_TYPE_CLASS_CHECK (NODE)->has_implicit_copy_constructor)
02707
02708 /* The copy constructor to use if the front-end needs to copy objects. */
02709 #define CLASSTYPE_COPY_CONSTRUCTOR(NODE) \
02710 (LANG_TYPE_CLASS_CHECK (NODE)->copy_constructor)
02711 #endif
02712
02713 /* C++: all of these are overloaded! These apply only to TYPE_DECLs. */
02714
02715 /* The format of each node in the DECL_FRIENDLIST is as follows:
02716
02717 The TREE_PURPOSE will be the name of a function, i.e., an
02718 IDENTIFIER_NODE. The TREE_VALUE will be itself a TREE_LIST, whose
02719 TREE_VALUEs are friends with the given name. */
02720 #define DECL_FRIENDLIST(NODE) (DECL_INITIAL (NODE))
02721 #define FRIEND_NAME(LIST) (TREE_PURPOSE (LIST))
02722 #define FRIEND_DECLS(LIST) (TREE_VALUE (LIST))
02723
02724 /* The DECL_ACCESS, if non-NULL, is a TREE_LIST. The TREE_PURPOSE of
02725 each node is a type; the TREE_VALUE is the access granted for this
02726 DECL in that type. The DECL_ACCESS is set by access declarations.
02727 For example, if a member that would normally be public in a
02728 derived class is made protected, then the derived class and the
02729 protected_access_node will appear in the DECL_ACCESS for the node. */
02730 #define DECL_ACCESS(NODE) (LANG_DECL_U2_CHECK (NODE, 0)->access)
02731
02732 /* Nonzero if the FUNCTION_DECL is a global constructor. */
02733 #define DECL_GLOBAL_CTOR_P(NODE) \
02734 (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_ctor_p)
02735
02736 /* Nonzero if the FUNCTION_DECL is a global destructor. */
02737 #define DECL_GLOBAL_DTOR_P(NODE) \
02738 (DECL_LANG_SPECIFIC (NODE)->decl_flags.global_dtor_p)
02739
02740 /* Accessor macros for C++ template decl nodes. */
02741
02742 /* The DECL_TEMPLATE_PARMS are a list. The TREE_PURPOSE of each node
02743 is a INT_CST whose TREE_INT_CST_LOW indicates the level of the
02744 template parameters, with 1 being the outermost set of template
02745 parameters. The TREE_VALUE is a vector, whose elements are the
02746 template parameters at each level. Each element in the vector is a
02747 TREE_LIST, whose TREE_VALUE is a PARM_DECL (if the parameter is a
02748 non-type parameter), or a TYPE_DECL (if the parameter is a type
02749 parameter). The TREE_PURPOSE is the default value, if any. The
02750 TEMPLATE_PARM_INDEX for the parameter is available as the
02751 DECL_INITIAL (for a PARM_DECL) or as the TREE_TYPE (for a
02752 TYPE_DECL). */
02753 #define DECL_TEMPLATE_PARMS(NODE) DECL_NON_COMMON_CHECK (NODE)->decl_non_common.arguments
02754 #define DECL_INNERMOST_TEMPLATE_PARMS(NODE) \
02755 INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (NODE))
02756 #define DECL_NTPARMS(NODE) \
02757 TREE_VEC_LENGTH (DECL_INNERMOST_TEMPLATE_PARMS (NODE))
02758 /* For function, method, class-data templates. */
02759 #define DECL_TEMPLATE_RESULT(NODE) DECL_RESULT_FLD (NODE)
02760 /* For a static member variable template, the
02761 DECL_TEMPLATE_INSTANTIATIONS list contains the explicitly and
02762 implicitly generated instantiations of the variable. There are no
02763 partial instantiations of static member variables, so all of these
02764 will be full instantiations.
02765
02766 For a class template the DECL_TEMPLATE_INSTANTIATIONS lists holds
02767 all instantiations and specializations of the class type, including
02768 partial instantiations and partial specializations.
02769
02770 In both cases, the TREE_PURPOSE of each node contains the arguments
02771 used; the TREE_VALUE contains the generated variable. The template
02772 arguments are always complete. For example, given:
02773
02774 template <class T> struct S1 {
02775 template <class U> struct S2 {};
02776 template <class U> struct S2<U*> {};
02777 };
02778
02779 the record for the partial specialization will contain, as its
02780 argument list, { {T}, {U*} }, and will be on the
02781 DECL_TEMPLATE_INSTANTIATIONS list for `template <class T> template
02782 <class U> struct S1<T>::S2'.
02783
02784 This list is not used for function templates. */
02785 #define DECL_TEMPLATE_INSTANTIATIONS(NODE) DECL_VINDEX (NODE)
02786 /* For a function template, the DECL_TEMPLATE_SPECIALIZATIONS lists
02787 contains all instantiations and specializations of the function,
02788 including partial instantiations. For a partial instantiation
02789 which is a specialization, this list holds only full
02790 specializations of the template that are instantiations of the
02791 partial instantiation. For example, given:
02792
02793 template <class T> struct S {
02794 template <class U> void f(U);
02795 template <> void f(T);
02796 };
02797
02798 the `S<int>::f<int>(int)' function will appear on the
02799 DECL_TEMPLATE_SPECIALIZATIONS list for both `template <class T>
02800 template <class U> void S<T>::f(U)' and `template <class T> void
02801 S<int>::f(T)'. In the latter case, however, it will have only the
02802 innermost set of arguments (T, in this case). The DECL_TI_TEMPLATE
02803 for the function declaration will point at the specialization, not
02804 the fully general template.
02805
02806 For a class template, this list contains the partial
02807 specializations of this template. (Full specializations are not
02808 recorded on this list.) The TREE_PURPOSE holds the arguments used
02809 in the partial specialization (e.g., for `template <class T> struct
02810 S<T*, int>' this will be `T*'.) The arguments will also include
02811 any outer template arguments. The TREE_VALUE holds the innermost
02812 template parameters for the specialization (e.g., `T' in the
02813 example above.) The TREE_TYPE is the _TYPE node for the partial
02814 specialization.
02815
02816 This list is not used for static variable templates. */
02817 #define DECL_TEMPLATE_SPECIALIZATIONS(NODE) DECL_SIZE (NODE)
02818
02819 /* Nonzero for a DECL which is actually a template parameter. Keep
02820 these checks in ascending tree code order. */
02821 #define DECL_TEMPLATE_PARM_P(NODE) \
02822 (DECL_LANG_FLAG_0 (NODE) \
02823 && (TREE_CODE (NODE) == CONST_DECL \
02824 || TREE_CODE (NODE) == PARM_DECL \
02825 || TREE_CODE (NODE) == TYPE_DECL \
02826 || TREE_CODE (NODE) == TEMPLATE_DECL))
02827
02828 /* Mark NODE as a template parameter. */
02829 #define SET_DECL_TEMPLATE_PARM_P(NODE) \
02830 (DECL_LANG_FLAG_0 (NODE) = 1)
02831
02832 /* Nonzero if NODE is a template template parameter. */
02833 #define DECL_TEMPLATE_TEMPLATE_PARM_P(NODE) \
02834 (TREE_CODE (NODE) == TEMPLATE_DECL && DECL_TEMPLATE_PARM_P (NODE))
02835
02836 /* Nonzero if NODE is a TEMPLATE_DECL representing an
02837 UNBOUND_CLASS_TEMPLATE tree node. */
02838 #define DECL_UNBOUND_CLASS_TEMPLATE_P(NODE) \
02839 (TREE_CODE (NODE) == TEMPLATE_DECL && !DECL_TEMPLATE_RESULT (NODE))
02840
02841 #define DECL_FUNCTION_TEMPLATE_P(NODE) \
02842 (TREE_CODE (NODE) == TEMPLATE_DECL \
02843 && !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \
02844 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == FUNCTION_DECL)
02845
02846 /* Nonzero for a DECL that represents a template class. */
02847 #define DECL_CLASS_TEMPLATE_P(NODE) \
02848 (TREE_CODE (NODE) == TEMPLATE_DECL \
02849 && !DECL_UNBOUND_CLASS_TEMPLATE_P (NODE) \
02850 && TREE_CODE (DECL_TEMPLATE_RESULT (NODE)) == TYPE_DECL \
02851 && !DECL_TEMPLATE_TEMPLATE_PARM_P (NODE))
02852
02853 /* Nonzero if NODE which declares a type. */
02854 #define DECL_DECLARES_TYPE_P(NODE) \
02855 (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
02856
02857 /* Nonzero if NODE is the typedef implicitly generated for a type when
02858 the type is declared. In C++, `struct S {};' is roughly
02859 equivalent to `struct S {}; typedef struct S S;' in C.
02860 DECL_IMPLICIT_TYPEDEF_P will hold for the typedef indicated in this
02861 example. In C++, there is a second implicit typedef for each
02862 class, in the scope of `S' itself, so that you can say `S::S'.
02863 DECL_SELF_REFERENCE_P will hold for that second typedef. */
02864 #define DECL_IMPLICIT_TYPEDEF_P(NODE) \
02865 (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE))
02866 #define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \
02867 (DECL_LANG_FLAG_2 (NODE) = 1)
02868 #define DECL_SELF_REFERENCE_P(NODE) \
02869 (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_4 (NODE))
02870 #define SET_DECL_SELF_REFERENCE_P(NODE) \
02871 (DECL_LANG_FLAG_4 (NODE) = 1)
02872
02873 /* A `primary' template is one that has its own template header. A
02874 member function of a class template is a template, but not primary.
02875 A member template is primary. Friend templates are primary, too. */
02876
02877 /* Returns the primary template corresponding to these parameters. */
02878 #define DECL_PRIMARY_TEMPLATE(NODE) \
02879 (TREE_TYPE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
02880
02881 /* Returns nonzero if NODE is a primary template. */
02882 #define PRIMARY_TEMPLATE_P(NODE) (DECL_PRIMARY_TEMPLATE (NODE) == (NODE))
02883
02884 /* Non-zero iff NODE is a specialization of a template. The value
02885 indicates the type of specializations:
02886
02887 1=implicit instantiation
02888
02889 2=partial or explicit specialization, e.g.:
02890
02891 template <> int min<int> (int, int),
02892
02893 3=explicit instantiation, e.g.:
02894
02895 template int min<int> (int, int);
02896
02897 Note that NODE will be marked as a specialization even if the
02898 template it is instantiating is not a primary template. For
02899 example, given:
02900
02901 template <typename T> struct O {
02902 void f();
02903 struct I {};
02904 };
02905
02906 both O<int>::f and O<int>::I will be marked as instantiations.
02907
02908 If DECL_USE_TEMPLATE is non-zero, then DECL_TEMPLATE_INFO will also
02909 be non-NULL. */
02910 #define DECL_USE_TEMPLATE(NODE) (DECL_LANG_SPECIFIC (NODE)->decl_flags.use_template)
02911
02912 /* Like DECL_USE_TEMPLATE, but for class types. */
02913 #define CLASSTYPE_USE_TEMPLATE(NODE) \
02914 (LANG_TYPE_CLASS_CHECK (NODE)->use_template)
02915
02916 /* True if NODE is a specialization of a primary template. */
02917 #define CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P(NODE) \
02918 (CLASS_TYPE_P (NODE) \
02919 && CLASSTYPE_USE_TEMPLATE (NODE) \
02920 && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (arg)))
02921
02922 #define DECL_TEMPLATE_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) & 1)
02923 #define CLASSTYPE_TEMPLATE_INSTANTIATION(NODE) \
02924 (CLASSTYPE_USE_TEMPLATE (NODE) & 1)
02925
02926 #define DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) == 2)
02927 #define SET_DECL_TEMPLATE_SPECIALIZATION(NODE) (DECL_USE_TEMPLATE (NODE) = 2)
02928
02929 /* Returns true for an explicit or partial specialization of a class
02930 template. */
02931 #define CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
02932 (CLASSTYPE_USE_TEMPLATE (NODE) == 2)
02933 #define SET_CLASSTYPE_TEMPLATE_SPECIALIZATION(NODE) \
02934 (CLASSTYPE_USE_TEMPLATE (NODE) = 2)
02935
02936 #define DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 1)
02937 #define SET_DECL_IMPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 1)
02938 #define CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
02939 (CLASSTYPE_USE_TEMPLATE (NODE) == 1)
02940 #define SET_CLASSTYPE_IMPLICIT_INSTANTIATION(NODE) \
02941 (CLASSTYPE_USE_TEMPLATE (NODE) = 1)
02942
02943 #define DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) == 3)
02944 #define SET_DECL_EXPLICIT_INSTANTIATION(NODE) (DECL_USE_TEMPLATE (NODE) = 3)
02945 #define CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
02946 (CLASSTYPE_USE_TEMPLATE (NODE) == 3)
02947 #define SET_CLASSTYPE_EXPLICIT_INSTANTIATION(NODE) \
02948 (CLASSTYPE_USE_TEMPLATE (NODE) = 3)
02949
02950 /* Nonzero if DECL is a friend function which is an instantiation
02951 from the point of view of the compiler, but not from the point of
02952 view of the language. For example given:
02953 template <class T> struct S { friend void f(T) {}; };
02954 the declaration of `void f(int)' generated when S<int> is
02955 instantiated will not be a DECL_TEMPLATE_INSTANTIATION, but will be
02956 a DECL_FRIEND_PSUEDO_TEMPLATE_INSTANTIATION. */
02957 #define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
02958 (DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
02959
02960 /* Nonzero iff we are currently processing a declaration for an
02961 entity with its own template parameter list, and which is not a
02962 full specialization. */
02963 #define PROCESSING_REAL_TEMPLATE_DECL_P() \
02964 (processing_template_decl > template_class_depth (current_scope ()))
02965
02966 /* Nonzero if this VAR_DECL or FUNCTION_DECL has already been
02967 instantiated, i.e. its definition has been generated from the
02968 pattern given in the template. */
02969 #define DECL_TEMPLATE_INSTANTIATED(NODE) \
02970 DECL_LANG_FLAG_1 (VAR_OR_FUNCTION_DECL_CHECK (NODE))
02971
02972 /* We know what we're doing with this decl now. */
02973 #define DECL_INTERFACE_KNOWN(NODE) DECL_LANG_FLAG_5 (NODE)
02974
02975 /* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
02976 so that assemble_external will work properly. So we have this flag to
02977 tell us whether the decl is really not external. */
02978 #define DECL_NOT_REALLY_EXTERN(NODE) \
02979 (DECL_LANG_SPECIFIC (NODE)->decl_flags.not_really_extern)
02980
02981 #define DECL_REALLY_EXTERN(NODE) \
02982 (DECL_EXTERNAL (NODE) && ! DECL_NOT_REALLY_EXTERN (NODE))
02983
02984 /* A thunk is a stub function.
02985
02986 A thunk is an alternate entry point for an ordinary FUNCTION_DECL.
02987 The address of the ordinary FUNCTION_DECL is given by the
02988 DECL_INITIAL, which is always an ADDR_EXPR whose operand is a
02989 FUNCTION_DECL. The job of the thunk is to either adjust the this
02990 pointer before transferring control to the FUNCTION_DECL, or call
02991 FUNCTION_DECL and then adjust the result value. Note, the result
02992 pointer adjusting thunk must perform a call to the thunked
02993 function, (or be implemented via passing some invisible parameter
02994 to the thunked function, which is modified to perform the
02995 adjustment just before returning).
02996
02997 A thunk may perform either, or both, of the following operations:
02998
02999 o Adjust the this or result pointer by a constant offset.
03000 o Adjust the this or result pointer by looking up a vcall or vbase offset
03001 in the vtable.
03002
03003 A this pointer adjusting thunk converts from a base to a derived
03004 class, and hence adds the offsets. A result pointer adjusting thunk
03005 converts from a derived class to a base, and hence subtracts the
03006 offsets. If both operations are performed, then the constant
03007 adjustment is performed first for this pointer adjustment and last
03008 for the result pointer adjustment.
03009
03010 The constant adjustment is given by THUNK_FIXED_OFFSET. If the
03011 vcall or vbase offset is required, THUNK_VIRTUAL_OFFSET is
03012 used. For this pointer adjusting thunks, it is the vcall offset
03013 into the vtable. For result pointer adjusting thunks it is the
03014 binfo of the virtual base to convert to. Use that binfo's vbase
03015 offset.
03016
03017 It is possible to have equivalent covariant thunks. These are
03018 distinct virtual covariant thunks whose vbase offsets happen to
03019 have the same value. THUNK_ALIAS is used to pick one as the
03020 canonical thunk, which will get all the this pointer adjusting
03021 thunks attached to it. */
03022
03023 /* An integer indicating how many bytes should be subtracted from the
03024 this or result pointer when this function is called. */
03025 #define THUNK_FIXED_OFFSET(DECL) \
03026 (DECL_LANG_SPECIFIC (THUNK_FUNCTION_CHECK (DECL))->u.f.u5.fixed_offset)
03027
03028 /* A tree indicating how to perform the virtual adjustment. For a this
03029 adjusting thunk it is the number of bytes to be added to the vtable
03030 to find the vcall offset. For a result adjusting thunk, it is the
03031 binfo of the relevant virtual base. If NULL, then there is no
03032 virtual adjust. (The vptr is always located at offset zero from
03033 the this or result pointer.) (If the covariant type is within the
03034 class hierarchy being laid out, the vbase index is not yet known
03035 at the point we need to create the thunks, hence the need to use
03036 binfos.) */
03037
03038 #define THUNK_VIRTUAL_OFFSET(DECL) \
03039 (LANG_DECL_U2_CHECK (FUNCTION_DECL_CHECK (DECL), 0)->access)
03040
03041 /* A thunk which is equivalent to another thunk. */
03042 #define THUNK_ALIAS(DECL) \
03043 (DECL_LANG_SPECIFIC (FUNCTION_DECL_CHECK (DECL))->decl_flags.u.template_info)
03044
03045 /* For thunk NODE, this is the FUNCTION_DECL thunked to. It is
03046 possible for the target to be a thunk too. */
03047 #define THUNK_TARGET(NODE) \
03048 (DECL_LANG_SPECIFIC (NODE)->u.f.befriending_classes)
03049
03050 /* True for a SCOPE_REF iff the "template" keyword was used to
03051 indicate that the qualified name denotes a template. */
03052 #define QUALIFIED_NAME_IS_TEMPLATE(NODE) \
03053 (TREE_LANG_FLAG_0 (SCOPE_REF_CHECK (NODE)))
03054
03055 /* True for an OMP_ATOMIC that has dependent parameters. These are stored
03056 as bare LHS/RHS, and not as ADDR/RHS, as in the generic statement. */
03057 #define OMP_ATOMIC_DEPENDENT_P(NODE) \
03058 (TREE_LANG_FLAG_0 (OMP_ATOMIC_CHECK (NODE)))
03059
03060 /* Used to store the operation code when OMP_ATOMIC_DEPENDENT_P is set. */
03061 #define OMP_ATOMIC_CODE(NODE) \
03062 (OMP_ATOMIC_CHECK (NODE)->exp.complexity)
03063
03064 /* Used while gimplifying continue statements bound to OMP_FOR nodes. */
03065 #define OMP_FOR_GIMPLIFYING_P(NODE) \
03066 (TREE_LANG_FLAG_0 (OMP_FOR_CHECK (NODE)))
03067
03068 /* A language-specific token attached to the OpenMP data clauses to
03069 hold code (or code fragments) related to ctors, dtors, and op=.
03070 See semantics.c for details. */
03071 #define CP_OMP_CLAUSE_INFO(NODE) \
03072 TREE_TYPE (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_PRIVATE, \
03073 OMP_CLAUSE_COPYPRIVATE))
03074
03075 /* These macros provide convenient access to the various _STMT nodes
03076 created when parsing template declarations. */
03077 #define TRY_STMTS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 0)
03078 #define TRY_HANDLERS(NODE) TREE_OPERAND (TRY_BLOCK_CHECK (NODE), 1)
03079
03080 #define EH_SPEC_STMTS(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 0)
03081 #define EH_SPEC_RAISES(NODE) TREE_OPERAND (EH_SPEC_BLOCK_CHECK (NODE), 1)
03082
03083 #define USING_STMT_NAMESPACE(NODE) TREE_OPERAND (USING_STMT_CHECK (NODE), 0)
03084
03085 /* Nonzero if this try block is a function try block. */
03086 #define FN_TRY_BLOCK_P(NODE) TREE_LANG_FLAG_3 (TRY_BLOCK_CHECK (NODE))
03087 #define HANDLER_PARMS(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 0)
03088 #define HANDLER_BODY(NODE) TREE_OPERAND (HANDLER_CHECK (NODE), 1)
03089 #define HANDLER_TYPE(NODE) TREE_TYPE (HANDLER_CHECK (NODE))
03090
03091 /* CLEANUP_STMT accessors. The statement(s) covered, the cleanup to run
03092 and the VAR_DECL for which this cleanup exists. */
03093 #define CLEANUP_BODY(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 0)
03094 #define CLEANUP_EXPR(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 1)
03095 #define CLEANUP_DECL(NODE) TREE_OPERAND (CLEANUP_STMT_CHECK (NODE), 2)
03096
03097 /* IF_STMT accessors. These give access to the condition of the if
03098 statement, the then block of the if statement, and the else block
03099 of the if statement if it exists. */
03100 #define IF_COND(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 0)
03101 #define THEN_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 1)
03102 #define ELSE_CLAUSE(NODE) TREE_OPERAND (IF_STMT_CHECK (NODE), 2)
03103
03104 /* WHILE_STMT accessors. These give access to the condition of the
03105 while statement and the body of the while statement, respectively. */
03106 #define WHILE_COND(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 0)
03107 #define WHILE_BODY(NODE) TREE_OPERAND (WHILE_STMT_CHECK (NODE), 1)
03108
03109 /* DO_STMT accessors. These give access to the condition of the do
03110 statement and the body of the do statement, respectively. */
03111 #define DO_COND(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 0)
03112 #define DO_BODY(NODE) TREE_OPERAND (DO_STMT_CHECK (NODE), 1)
03113
03114 /* FOR_STMT accessors. These give access to the init statement,
03115 condition, update expression, and body of the for statement,
03116 respectively. */
03117 #define FOR_INIT_STMT(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 0)
03118 #define FOR_COND(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 1)
03119 #define FOR_EXPR(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 2)
03120 #define FOR_BODY(NODE) TREE_OPERAND (FOR_STMT_CHECK (NODE), 3)
03121
03122 #define SWITCH_STMT_COND(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 0)
03123 #define SWITCH_STMT_BODY(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 1)
03124 #define SWITCH_STMT_TYPE(NODE) TREE_OPERAND (SWITCH_STMT_CHECK (NODE), 2)
03125
03126 /* STMT_EXPR accessor. */
03127 #define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
03128
03129 /* EXPR_STMT accessor. This gives the expression associated with an
03130 expression statement. */
03131 #define EXPR_STMT_EXPR(NODE) TREE_OPERAND (EXPR_STMT_CHECK (NODE), 0)
03132
03133 /* True if this TARGET_EXPR was created by build_cplus_new, and so we can
03134 discard it if it isn't useful. */
03135 #define TARGET_EXPR_IMPLICIT_P(NODE) \
03136 TREE_LANG_FLAG_0 (TARGET_EXPR_CHECK (NODE))
03137
03138 /* An enumeration of the kind of tags that C++ accepts. */
03139 enum tag_types {
03140 none_type = 0, /* Not a tag type. */
03141 record_type, /* "struct" types. */
03142 class_type, /* "class" types. */
03143 union_type, /* "union" types. */
03144 enum_type, /* "enum" types. */
03145 typename_type /* "typename" types. */
03146 };
03147
03148 /* The various kinds of lvalues we distinguish. */
03149 typedef enum cp_lvalue_kind {
03150 clk_none = 0, /* Things that are not an lvalue. */
03151 clk_ordinary = 1, /* An ordinary lvalue. */
03152 clk_class = 2, /* An rvalue of class-type. */
03153 clk_bitfield = 4, /* An lvalue for a bit-field. */
03154 clk_packed = 8 /* An lvalue for a packed field. */
03155 } cp_lvalue_kind;
03156
03157 /* Various kinds of template specialization, instantiation, etc. */
03158 typedef enum tmpl_spec_kind {
03159 tsk_none, /* Not a template at all. */
03160 tsk_invalid_member_spec, /* An explicit member template
03161 specialization, but the enclosing
03162 classes have not all been explicitly
03163 specialized. */
03164 tsk_invalid_expl_inst, /* An explicit instantiation containing
03165 template parameter lists. */
03166 tsk_excessive_parms, /* A template declaration with too many
03167 template parameter lists. */
03168 tsk_insufficient_parms, /* A template declaration with too few
03169 parameter lists. */
03170 tsk_template, /* A template declaration. */
03171 tsk_expl_spec, /* An explicit specialization. */
03172 tsk_expl_inst /* An explicit instantiation. */
03173 } tmpl_spec_kind;
03174
03175 /* The various kinds of access. BINFO_ACCESS depends on these being
03176 two bit quantities. The numerical values are important; they are
03177 used to initialize RTTI data structures, so changing them changes
03178 the ABI. */
03179 typedef enum access_kind {
03180 ak_none = 0, /* Inaccessible. */
03181 ak_public = 1, /* Accessible, as a `public' thing. */
03182 ak_protected = 2, /* Accessible, as a `protected' thing. */
03183 ak_private = 3 /* Accessible, as a `private' thing. */
03184 } access_kind;
03185
03186 /* The various kinds of special functions. If you add to this list,
03187 you should update special_function_p as well. */
03188 typedef enum special_function_kind {
03189 sfk_none = 0, /* Not a special function. This enumeral
03190 must have value zero; see
03191 special_function_p. */
03192 sfk_constructor, /* A constructor. */
03193 sfk_copy_constructor, /* A copy constructor. */
03194 sfk_assignment_operator, /* An assignment operator. */
03195 sfk_destructor, /* A destructor. */
03196 sfk_complete_destructor, /* A destructor for complete objects. */
03197 sfk_base_destructor, /* A destructor for base subobjects. */
03198 sfk_deleting_destructor, /* A destructor for complete objects that
03199 deletes the object after it has been
03200 destroyed. */
03201 sfk_conversion /* A conversion operator. */
03202 } special_function_kind;
03203
03204 /* The various kinds of linkage. From [basic.link],
03205
03206 A name is said to have linkage when it might denote the same
03207 object, reference, function, type, template, namespace or value
03208 as a name introduced in another scope:
03209
03210 -- When a name has external linkage, the entity it denotes can
03211 be referred to from scopes of other translation units or from
03212 other scopes of the same translation unit.
03213
03214 -- When a name has internal linkage, the entity it denotes can
03215 be referred to by names from other scopes in the same
03216 translation unit.
03217
03218 -- When a name has no linkage, the entity it denotes cannot be
03219 referred to by names from other scopes. */
03220
03221 typedef enum linkage_kind {
03222 lk_none, /* No linkage. */
03223 lk_internal, /* Internal linkage. */
03224 lk_external /* External linkage. */
03225 } linkage_kind;
03226
03227 /* Bitmask flags to control type substitution. */
03228 typedef enum tsubst_flags_t {
03229 tf_none = 0, /* nothing special */
03230 tf_error = 1 << 0, /* give error messages */
03231 tf_warning = 1 << 1, /* give warnings too */
03232 tf_ignore_bad_quals = 1 << 2, /* ignore bad cvr qualifiers */
03233 tf_keep_type_decl = 1 << 3, /* retain typedef type decls
03234 (make_typename_type use) */
03235 tf_ptrmem_ok = 1 << 4, /* pointers to member ok (internal
03236 instantiate_type use) */
03237 tf_user = 1 << 5, /* found template must be a user template
03238 (lookup_template_class use) */
03239 tf_conv = 1 << 6, /* We are determining what kind of
03240 conversion might be permissible,
03241 not actually performing the
03242 conversion. */
03243 /* Convenient substitution flags combinations. */
03244 tf_warning_or_error = tf_warning | tf_error
03245 } tsubst_flags_t;
03246
03247 /* The kind of checking we can do looking in a class hierarchy. */
03248 typedef enum base_access {
03249 ba_any = 0, /* Do not check access, allow an ambiguous base,
03250 prefer a non-virtual base */
03251 ba_unique = 1 << 0, /* Must be a unique base. */
03252 ba_check_bit = 1 << 1, /* Check access. */
03253 ba_check = ba_unique | ba_check_bit,
03254 ba_ignore_scope = 1 << 2, /* Ignore access allowed by local scope. */
03255 ba_quiet = 1 << 3 /* Do not issue error messages. */
03256 } base_access;
03257
03258 /* The various kinds of access check during parsing. */
03259 typedef enum deferring_kind {
03260 dk_no_deferred = 0, /* Check access immediately */
03261 dk_deferred = 1, /* Deferred check */
03262 dk_no_check = 2 /* No access check */
03263 } deferring_kind;
03264
03265 /* The kind of base we can find, looking in a class hierarchy.
03266 Values <0 indicate we failed. */
03267 typedef enum base_kind {
03268 bk_inaccessible = -3, /* The base is inaccessible */
03269 bk_ambig = -2, /* The base is ambiguous */
03270 bk_not_base = -1, /* It is not a base */
03271 bk_same_type = 0, /* It is the same type */
03272 bk_proper_base = 1, /* It is a proper base */
03273 bk_via_virtual = 2 /* It is a proper base, but via a virtual
03274 path. This might not be the canonical
03275 binfo. */
03276 } base_kind;
03277
03278 /* Node for "pointer to (virtual) function".
03279 This may be distinct from ptr_type_node so gdb can distinguish them. */
03280 #define vfunc_ptr_type_node vtable_entry_type
03281
03282
03283 /* For building calls to `delete'. */
03284 extern GTY(()) tree integer_two_node;
03285 extern GTY(()) tree integer_three_node;
03286
03287 /* The number of function bodies which we are currently processing.
03288 (Zero if we are at namespace scope, one inside the body of a
03289 function, two inside the body of a function in a local class, etc.) */
03290 extern int function_depth;
03291
03292 /* in pt.c */
03293
03294 /* These values are used for the `STRICT' parameter to type_unification and
03295 fn_type_unification. Their meanings are described with the
03296 documentation for fn_type_unification. */
03297
03298 typedef enum unification_kind_t {
03299 DEDUCE_CALL,
03300 DEDUCE_CONV,
03301 DEDUCE_EXACT
03302 } unification_kind_t;
03303
03304 /* Macros for operating on a template instantiation level node. */
03305
03306 #define TINST_DECL(NODE) \
03307 (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->decl)
03308 #define TINST_LOCATION(NODE) \
03309 (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->locus)
03310 #define TINST_IN_SYSTEM_HEADER_P(NODE) \
03311 (((tinst_level_t) TINST_LEVEL_CHECK (NODE))->in_system_header_p)
03312
03313 /* in class.c */
03314
03315 extern int current_class_depth;
03316
03317 /* An array of all local classes present in this translation unit, in
03318 declaration order. */
03319 extern GTY(()) VEC(tree,gc) *local_classes;
03320
03321 /* Here's where we control how name mangling takes place. */
03322
03323 /* Cannot use '$' up front, because this confuses gdb
03324 (names beginning with '$' are gdb-local identifiers).
03325
03326 Note that all forms in which the '$' is significant are long enough
03327 for direct indexing (meaning that if we know there is a '$'
03328 at a particular location, we can index into the string at
03329 any other location that provides distinguishing characters). */
03330
03331 /* Define NO_DOLLAR_IN_LABEL in your favorite tm file if your assembler
03332 doesn't allow '$' in symbol names. */
03333 #ifndef NO_DOLLAR_IN_LABEL
03334
03335 #define JOINER '$'
03336
03337 #define AUTO_TEMP_NAME "_$tmp_"
03338 #define VFIELD_BASE "$vf"
03339 #define VFIELD_NAME "_vptr$"
03340 #define VFIELD_NAME_FORMAT "_vptr$%s"
03341 #define ANON_AGGRNAME_FORMAT "$_%d"
03342
03343 #else /* NO_DOLLAR_IN_LABEL */
03344
03345 #ifndef NO_DOT_IN_LABEL
03346
03347 #define JOINER '.'
03348
03349 #define AUTO_TEMP_NAME "_.tmp_"
03350 #define VFIELD_BASE ".vf"
03351 #define VFIELD_NAME "_vptr."
03352 #define VFIELD_NAME_FORMAT "_vptr.%s"
03353
03354 #define ANON_AGGRNAME_FORMAT "._%d"
03355
03356 #else /* NO_DOT_IN_LABEL */
03357
03358 #define IN_CHARGE_NAME "__in_chrg"
03359 #define AUTO_TEMP_NAME "__tmp_"
03360 #define TEMP_NAME_P(ID_NODE) \
03361 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, \
03362 sizeof (AUTO_TEMP_NAME) - 1))
03363 #define VTABLE_NAME "__vt_"
03364 #define VTABLE_NAME_P(ID_NODE) \
03365 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VTABLE_NAME, \
03366 sizeof (VTABLE_NAME) - 1))
03367 #define VFIELD_BASE "__vfb"
03368 #define VFIELD_NAME "__vptr_"
03369 #define VFIELD_NAME_P(ID_NODE) \
03370 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, \
03371 sizeof (VFIELD_NAME) - 1))
03372 #define VFIELD_NAME_FORMAT "__vptr_%s"
03373
03374 #define ANON_AGGRNAME_PREFIX "__anon_"
03375 #define ANON_AGGRNAME_P(ID_NODE) \
03376 (!strncmp (IDENTIFIER_POINTER (ID_NODE), ANON_AGGRNAME_PREFIX, \
03377 sizeof (ANON_AGGRNAME_PREFIX) - 1))
03378 #define ANON_AGGRNAME_FORMAT "__anon_%d"
03379
03380 #endif /* NO_DOT_IN_LABEL */
03381 #endif /* NO_DOLLAR_IN_LABEL */
03382
03383 #define THIS_NAME "this"
03384
03385 #define IN_CHARGE_NAME "__in_chrg"
03386
03387 #define VTBL_PTR_TYPE "__vtbl_ptr_type"
03388 #define VTABLE_DELTA_NAME "__delta"
03389 #define VTABLE_PFN_NAME "__pfn"
03390
03391 #if !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL)
03392
03393 #define VTABLE_NAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[1] == 'v' \
03394 && IDENTIFIER_POINTER (ID_NODE)[2] == 't' \
03395 && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER)
03396
03397 #define TEMP_NAME_P(ID_NODE) \
03398 (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1))
03399 #define VFIELD_NAME_P(ID_NODE) \
03400 (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1))
03401
03402 /* For anonymous aggregate types, we need some sort of name to
03403 hold on to. In practice, this should not appear, but it should
03404 not be harmful if it does. */
03405 #define ANON_AGGRNAME_P(ID_NODE) (IDENTIFIER_POINTER (ID_NODE)[0] == JOINER \
03406 && IDENTIFIER_POINTER (ID_NODE)[1] == '_')
03407 #endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
03408
03409
03410 /* Nonzero if we're done parsing and into end-of-file activities. */
03411
03412 extern int at_eof;
03413
03414 /* A list of namespace-scope objects which have constructors or
03415 destructors which reside in the global scope. The decl is stored
03416 in the TREE_VALUE slot and the initializer is stored in the
03417 TREE_PURPOSE slot. */
03418 extern GTY(()) tree static_aggregates;
03419
03420 /* Functions called along with real static constructors and destructors. */
03421
03422 extern GTY(()) tree static_ctors;
03423 extern GTY(()) tree static_dtors;
03424
03425 enum overload_flags { NO_SPECIAL = 0, DTOR_FLAG, OP_FLAG, TYPENAME_FLAG };
03426
03427 /* These are uses as bits in flags passed to various functions to
03428 control their behavior. Despite the LOOKUP_ prefix, many of these
03429 do not control name lookup. ??? Functions using these flags should
03430 probably be modified to accept explicit boolean flags for the
03431 behaviors relevant to them. */
03432 /* Check for access violations. */
03433 #define LOOKUP_PROTECT (1 << 0)
03434 /* Complain if no suitable member function matching the arguments is
03435 found. */
03436 #define LOOKUP_COMPLAIN (1 << 1)
03437 #define LOOKUP_NORMAL (LOOKUP_PROTECT | LOOKUP_COMPLAIN)
03438 /* Even if the function found by lookup is a virtual function, it
03439 should be called directly. */
03440 #define LOOKUP_NONVIRTUAL (1 << 2)
03441 /* Non-converting (i.e., "explicit") constructors are not tried. */
03442 #define LOOKUP_ONLYCONVERTING (1 << 3)
03443 /* If a temporary is created, it should be created so that it lives
03444 as long as the current variable bindings; otherwise it only lives
03445 until the end of the complete-expression. It also forces
03446 direct-initialization in cases where other parts of the compiler
03447 have already generated a temporary, such as reference
03448 initialization and the catch parameter. */
03449 #define DIRECT_BIND (1 << 4)
03450 /* User-defined conversions are not permitted. (Built-in conversions
03451 are permitted.) */
03452 #define LOOKUP_NO_CONVERSION (1 << 5)
03453 /* The user has explicitly called a destructor. (Therefore, we do
03454 not need to check that the object is non-NULL before calling the
03455 destructor.) */
03456 #define LOOKUP_DESTRUCTOR (1 << 6)
03457 /* Do not permit references to bind to temporaries. */
03458 #define LOOKUP_NO_TEMP_BIND (1 << 7)
03459 /* Do not accept objects, and possibly namespaces. */
03460 #define LOOKUP_PREFER_TYPES (1 << 8)
03461 /* Do not accept objects, and possibly types. */
03462 #define LOOKUP_PREFER_NAMESPACES (1 << 9)
03463 /* Accept types or namespaces. */
03464 #define LOOKUP_PREFER_BOTH (LOOKUP_PREFER_TYPES | LOOKUP_PREFER_NAMESPACES)
03465 /* We are checking that a constructor can be called -- but we do not
03466 actually plan to call it. */
03467 #define LOOKUP_CONSTRUCTOR_CALLABLE (1 << 10)
03468 /* Return friend declarations and un-declared builtin functions.
03469 (Normally, these entities are registered in the symbol table, but
03470 not found by lookup.) */
03471 #define LOOKUP_HIDDEN (LOOKUP_CONSTRUCTOR_CALLABLE << 1)
03472
03473 #define LOOKUP_NAMESPACES_ONLY(F) \
03474 (((F) & LOOKUP_PREFER_NAMESPACES) && !((F) & LOOKUP_PREFER_TYPES))
03475 #define LOOKUP_TYPES_ONLY(F) \
03476 (!((F) & LOOKUP_PREFER_NAMESPACES) && ((F) & LOOKUP_PREFER_TYPES))
03477 #define LOOKUP_QUALIFIERS_ONLY(F) ((F) & LOOKUP_PREFER_BOTH)
03478
03479
03480 /* These flags are used by the conversion code.
03481 CONV_IMPLICIT : Perform implicit conversions (standard and user-defined).
03482 CONV_STATIC : Perform the explicit conversions for static_cast.
03483 CONV_CONST : Perform the explicit conversions for const_cast.
03484 CONV_REINTERPRET: Perform the explicit conversions for reinterpret_cast.
03485 CONV_PRIVATE : Perform upcasts to private bases.
03486 CONV_FORCE_TEMP : Require a new temporary when converting to the same
03487 aggregate type. */
03488
03489 #define CONV_IMPLICIT 1
03490 #define CONV_STATIC 2
03491 #define CONV_CONST 4
03492 #define CONV_REINTERPRET 8
03493 #define CONV_PRIVATE 16
03494 /* #define CONV_NONCONVERTING 32 */
03495 #define CONV_FORCE_TEMP 64
03496 #define CONV_OLD_CONVERT (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
03497 | CONV_REINTERPRET)
03498 #define CONV_C_CAST (CONV_IMPLICIT | CONV_STATIC | CONV_CONST \
03499 | CONV_REINTERPRET | CONV_PRIVATE | CONV_FORCE_TEMP)
03500
03501 /* Used by build_expr_type_conversion to indicate which types are
03502 acceptable as arguments to the expression under consideration. */
03503
03504 #define WANT_INT 1 /* integer types, including bool */
03505 #define WANT_FLOAT 2 /* floating point types */
03506 #define WANT_ENUM 4 /* enumerated types */
03507 #define WANT_POINTER 8 /* pointer types */
03508 #define WANT_NULL 16 /* null pointer constant */
03509 #define WANT_VECTOR 32 /* vector types */
03510 #define WANT_ARITH (WANT_INT | WANT_FLOAT | WANT_VECTOR)
03511
03512 /* Used with comptypes, and related functions, to guide type
03513 comparison. */
03514
03515 #define COMPARE_STRICT 0 /* Just check if the types are the
03516 same. */
03517 #define COMPARE_BASE 1 /* Check to see if the second type is
03518 derived from the first. */
03519 #define COMPARE_DERIVED 2 /* Like COMPARE_BASE, but in
03520 reverse. */
03521 #define COMPARE_REDECLARATION 4 /* The comparison is being done when
03522 another declaration of an existing
03523 entity is seen. */
03524
03525 /* Used with push_overloaded_decl. */
03526 #define PUSH_GLOBAL 0 /* Push the DECL into namespace scope,
03527 regardless of the current scope. */
03528 #define PUSH_LOCAL 1 /* Push the DECL into the current
03529 scope. */
03530 #define PUSH_USING 2 /* We are pushing this DECL as the
03531 result of a using declaration. */
03532
03533 /* Used with start function. */
03534 #define SF_DEFAULT 0 /* No flags. */
03535 #define SF_PRE_PARSED 1 /* The function declaration has
03536 already been parsed. */
03537 #define SF_INCLASS_INLINE 2 /* The function is an inline, defined
03538 in the class body. */
03539
03540 /* Returns nonzero iff TYPE1 and TYPE2 are the same type, or if TYPE2
03541 is derived from TYPE1, or if TYPE2 is a pointer (reference) to a
03542 class derived from the type pointed to (referred to) by TYPE1. */
03543 #define same_or_base_type_p(TYPE1, TYPE2) \
03544 comptypes ((TYPE1), (TYPE2), COMPARE_BASE)
03545
03546 /* These macros are used to access a TEMPLATE_PARM_INDEX. */
03547 #define TEMPLATE_PARM_INDEX_CAST(NODE) \
03548 ((template_parm_index*)TEMPLATE_PARM_INDEX_CHECK (NODE))
03549 #define TEMPLATE_PARM_IDX(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->index)
03550 #define TEMPLATE_PARM_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->level)
03551 #define TEMPLATE_PARM_DESCENDANTS(NODE) (TREE_CHAIN (NODE))
03552 #define TEMPLATE_PARM_ORIG_LEVEL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->orig_level)
03553 #define TEMPLATE_PARM_DECL(NODE) (TEMPLATE_PARM_INDEX_CAST (NODE)->decl)
03554
03555 /* These macros are for accessing the fields of TEMPLATE_TYPE_PARM,
03556 TEMPLATE_TEMPLATE_PARM and BOUND_TEMPLATE_TEMPLATE_PARM nodes. */
03557 #define TEMPLATE_TYPE_PARM_INDEX(NODE) \
03558 (TREE_CHECK3 ((NODE), TEMPLATE_TYPE_PARM, TEMPLATE_TEMPLATE_PARM, \
03559 BOUND_TEMPLATE_TEMPLATE_PARM))->type.values
03560 #define TEMPLATE_TYPE_IDX(NODE) \
03561 (TEMPLATE_PARM_IDX (TEMPLATE_TYPE_PARM_INDEX (NODE)))
03562 #define TEMPLATE_TYPE_LEVEL(NODE) \
03563 (TEMPLATE_PARM_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
03564 #define TEMPLATE_TYPE_ORIG_LEVEL(NODE) \
03565 (TEMPLATE_PARM_ORIG_LEVEL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
03566 #define TEMPLATE_TYPE_DECL(NODE) \
03567 (TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (NODE)))
03568
03569 /* These constants can used as bit flags in the process of tree formatting.
03570
03571 TFF_PLAIN_IDENTIFIER: unqualified part of a name.
03572 TFF_SCOPE: include the class and namespace scope of the name.
03573 TFF_CHASE_TYPEDEF: print the original type-id instead of the typedef-name.
03574 TFF_DECL_SPECIFIERS: print decl-specifiers.
03575 TFF_CLASS_KEY_OR_ENUM: precede a class-type name (resp. enum name) with
03576 a class-key (resp. `enum').
03577 TFF_RETURN_TYPE: include function return type.
03578 TFF_FUNCTION_DEFAULT_ARGUMENTS: include function default parameter values.
03579 TFF_EXCEPTION_SPECIFICATION: show function exception specification.
03580 TFF_TEMPLATE_HEADER: show the template<...> header in a
03581 template-declaration.
03582 TFF_TEMPLATE_NAME: show only template-name.
03583 TFF_EXPR_IN_PARENS: parenthesize expressions.
03584 TFF_NO_FUNCTION_ARGUMENTS: don't show function arguments. */
03585
03586 #define TFF_PLAIN_IDENTIFIER (0)
03587 #define TFF_SCOPE (1)
03588 #define TFF_CHASE_TYPEDEF (1 << 1)
03589 #define TFF_DECL_SPECIFIERS (1 << 2)
03590 #define TFF_CLASS_KEY_OR_ENUM (1 << 3)
03591 #define TFF_RETURN_TYPE (1 << 4)
03592 #define TFF_FUNCTION_DEFAULT_ARGUMENTS (1 << 5)
03593 #define TFF_EXCEPTION_SPECIFICATION (1 << 6)
03594 #define TFF_TEMPLATE_HEADER (1 << 7)
03595 #define TFF_TEMPLATE_NAME (1 << 8)
03596 #define TFF_EXPR_IN_PARENS (1 << 9)
03597 #define TFF_NO_FUNCTION_ARGUMENTS (1 << 10)
03598
03599 /* Returns the TEMPLATE_DECL associated to a TEMPLATE_TEMPLATE_PARM
03600 node. */
03601 #define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE) \
03602 ((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM) \
03603 ? TYPE_TI_TEMPLATE (NODE) \
03604 : TYPE_NAME (NODE))
03605
03606 /* in lex.c */
03607
03608 extern void init_reswords (void);
03609
03610 /* Indexed by TREE_CODE, these tables give C-looking names to
03611 operators represented by TREE_CODES. For example,
03612 opname_tab[(int) MINUS_EXPR] == "-". */
03613 extern const char **opname_tab, **assignop_tab;
03614
03615 typedef struct operator_name_info_t GTY(())
03616 {
03617 /* The IDENTIFIER_NODE for the operator. */
03618 tree identifier;
03619 /* The name of the operator. */
03620 const char *name;
03621 /* The mangled name of the operator. */
03622 const char *mangled_name;
03623 /* The arity of the operator. */
03624 int arity;
03625 } operator_name_info_t;
03626
03627 /* A mapping from tree codes to operator name information. */
03628 extern GTY(()) operator_name_info_t operator_name_info
03629 [(int) LAST_CPLUS_TREE_CODE];
03630 /* Similar, but for assignment operators. */
03631 extern GTY(()) operator_name_info_t assignment_operator_name_info
03632 [(int) LAST_CPLUS_TREE_CODE];
03633
03634 /* A type-qualifier, or bitmask therefore, using the TYPE_QUAL
03635 constants. */
03636
03637 typedef int cp_cv_quals;
03638
03639 /* A storage class. */
03640
03641 typedef enum cp_storage_class {
03642 /* sc_none must be zero so that zeroing a cp_decl_specifier_seq
03643 sets the storage_class field to sc_none. */
03644 sc_none = 0,
03645 sc_auto,
03646 sc_register,
03647 sc_static,
03648 sc_extern,
03649 sc_mutable
03650 } cp_storage_class;
03651
03652 /* An individual decl-specifier. */
03653
03654 typedef enum cp_decl_spec {
03655 ds_first,
03656 ds_signed = ds_first,
03657 ds_unsigned,
03658 ds_short,
03659 ds_long,
03660 ds_const,
03661 ds_volatile,
03662 ds_restrict,
03663 ds_inline,
03664 ds_virtual,
03665 ds_explicit,
03666 ds_friend,
03667 ds_typedef,
03668 ds_complex,
03669 ds_thread,
03670 ds_last
03671 } cp_decl_spec;
03672
03673 /* A decl-specifier-seq. */
03674
03675 typedef struct cp_decl_specifier_seq {
03676 /* The number of times each of the keywords has been seen. */
03677 unsigned specs[(int) ds_last];
03678 /* The primary type, if any, given by the decl-specifier-seq.
03679 Modifiers, like "short", "const", and "unsigned" are not
03680 reflected here. This field will be a TYPE, unless a typedef-name
03681 was used, in which case it will be a TYPE_DECL. */
03682 tree type;
03683 /* The attributes, if any, provided with the specifier sequence. */
03684 tree attributes;
03685 /* If non-NULL, a built-in type that the user attempted to redefine
03686 to some other type. */
03687 tree redefined_builtin_type;
03688 /* The storage class specified -- or sc_none if no storage class was
03689 explicitly specified. */
03690 cp_storage_class storage_class;
03691 /* True iff TYPE_SPEC indicates a user-defined type. */
03692 BOOL_BITFIELD user_defined_type_p : 1;
03693 /* True iff multiple types were (erroneously) specified for this
03694 decl-specifier-seq. */
03695 BOOL_BITFIELD multiple_types_p : 1;
03696 /* True iff multiple storage classes were (erroneously) specified
03697 for this decl-specifier-seq or a combination of a storage class
03698 with a typedef specifier. */
03699 BOOL_BITFIELD conflicting_specifiers_p : 1;
03700 /* True iff at least one decl-specifier was found. */
03701 BOOL_BITFIELD any_specifiers_p : 1;
03702 /* True iff "int" was explicitly provided. */
03703 BOOL_BITFIELD explicit_int_p : 1;
03704 /* True iff "char" was explicitly provided. */
03705 BOOL_BITFIELD explicit_char_p : 1;
03706 } cp_decl_specifier_seq;
03707
03708 /* The various kinds of declarators. */
03709
03710 typedef enum cp_declarator_kind {
03711 cdk_id,
03712 cdk_function,
03713 cdk_array,
03714 cdk_pointer,
03715 cdk_reference,
03716 cdk_ptrmem,
03717 cdk_error
03718 } cp_declarator_kind;
03719
03720 /* A declarator. */
03721
03722 typedef struct cp_declarator cp_declarator;
03723
03724 typedef struct cp_parameter_declarator cp_parameter_declarator;
03725
03726 /* A parameter, before it has been semantically analyzed. */
03727 struct cp_parameter_declarator {
03728 /* The next parameter, or NULL_TREE if none. */
03729 cp_parameter_declarator *next;
03730 /* The decl-specifiers-seq for the parameter. */
03731 cp_decl_specifier_seq decl_specifiers;
03732 /* The declarator for the parameter. */
03733 cp_declarator *declarator;
03734 /* The default-argument expression, or NULL_TREE, if none. */
03735 tree default_argument;
03736 /* True iff this is the first parameter in the list and the
03737 parameter sequence ends with an ellipsis. */
03738 bool ellipsis_p;
03739 };
03740
03741 /* A declarator. */
03742 struct cp_declarator {
03743 /* The kind of declarator. */
03744 cp_declarator_kind kind;
03745 /* Attributes that apply to this declarator. */
03746 tree attributes;
03747 /* For all but cdk_id and cdk_error, the contained declarator. For
03748 cdk_id and cdk_error, guaranteed to be NULL. */
03749 cp_declarator *declarator;
03750 location_t id_loc; /* Currently only set for cdk_id. */
03751 union {
03752 /* For identifiers. */
03753 struct {
03754 /* If non-NULL, the qualifying scope (a NAMESPACE_DECL or
03755 *_TYPE) for this identifier. */
03756 tree qualifying_scope;
03757 /* The unqualified name of the entity -- an IDENTIFIER_NODE,
03758 BIT_NOT_EXPR, or TEMPLATE_ID_EXPR. */
03759 tree unqualified_name;
03760 /* If this is the name of a function, what kind of special
03761 function (if any). */
03762 special_function_kind sfk;
03763 } id;
03764 /* For functions. */
03765 struct {
03766 /* The parameters to the function. */
03767 cp_parameter_declarator *parameters;
03768 /* The cv-qualifiers for the function. */
03769 cp_cv_quals qualifiers;
03770 /* The exception-specification for the function. */
03771 tree exception_specification;
03772 } function;
03773 /* For arrays. */
03774 struct {
03775 /* The bounds to the array. */
03776 tree bounds;
03777 } array;
03778 /* For cdk_pointer, cdk_reference, and cdk_ptrmem. */
03779 struct {
03780 /* The cv-qualifiers for the pointer. */
03781 cp_cv_quals qualifiers;
03782 /* For cdk_ptrmem, the class type containing the member. */
03783 tree class_type;
03784 } pointer;
03785 } u;
03786 };
03787
03788 /* A parameter list indicating for a function with no parameters,
03789 e.g "int f(void)". */
03790 extern cp_parameter_declarator *no_parameters;
03791
03792 /* in call.c */
03793 extern bool check_dtor_name (tree, tree);
03794
03795 extern tree build_vfield_ref (tree, tree);
03796 extern tree build_conditional_expr (tree, tree, tree);
03797 extern tree build_addr_func (tree);
03798 extern tree build_call (tree, tree);
03799 extern bool null_ptr_cst_p (tree);
03800 extern bool sufficient_parms_p (tree);
03801 extern tree type_decays_to (tree);
03802 extern tree build_user_type_conversion (tree, tree, int);
03803 extern tree build_new_function_call (tree, tree, bool);
03804 extern tree build_operator_new_call (tree, tree, tree *, tree *,
03805 tree *);
03806 extern tree build_new_method_call (tree, tree, tree, tree, int,
03807 tree *);
03808 extern tree build_special_member_call (tree, tree, tree, tree, int);
03809 extern tree build_new_op (enum tree_code, int, tree, tree, tree, bool *);
03810 extern tree build_op_delete_call (enum tree_code, tree, tree, bool, tree, tree);
03811 extern bool can_convert (tree, tree);
03812 extern bool can_convert_arg (tree, tree, tree, int);
03813 extern bool can_convert_arg_bad (tree, tree, tree);
03814 extern bool enforce_access (tree, tree, tree);
03815 extern tree convert_default_arg (tree, tree, tree, int);
03816 extern tree convert_arg_to_ellipsis (tree);
03817 extern tree build_x_va_arg (tree, tree);
03818 extern tree cxx_type_promotes_to (tree);
03819 extern tree type_passed_as (tree);
03820 extern tree convert_for_arg_passing (tree, tree);
03821 extern bool is_properly_derived_from (tree, tree);
03822 extern tree initialize_reference (tree, tree, tree, tree *);
03823 extern tree make_temporary_var_for_ref_to_temp (tree, tree);
03824 extern tree strip_top_quals (tree);
03825 extern tree perform_implicit_conversion (tree, tree);
03826 extern tree perform_direct_initialization_if_possible (tree, tree, bool);
03827 extern tree in_charge_arg_for_name (tree);
03828 extern tree build_cxx_call (tree, tree);
03829 #ifdef ENABLE_CHECKING
03830 extern void validate_conversion_obstack (void);
03831 #endif /* ENABLE_CHECKING */
03832
03833 /* in class.c */
03834 extern tree build_base_path (enum tree_code, tree,
03835 tree, int);
03836 extern tree convert_to_base (tree, tree, bool, bool);
03837 extern tree convert_to_base_statically (tree, tree);
03838 extern tree build_vtbl_ref (tree, tree);
03839 extern tree build_vfn_ref (tree, tree);
03840 extern tree get_vtable_decl (tree, int);
03841 extern void resort_type_method_vec (void *, void *,
03842 gt_pointer_operator, void *);
03843 extern bool add_method (tree, tree, tree);
03844 extern bool currently_open_class (tree);
03845 extern tree currently_open_derived_class (tree);
03846 extern tree finish_struct (tree, tree);
03847 extern void finish_struct_1 (tree);
03848 extern int resolves_to_fixed_type_p (tree, int *);
03849 extern void init_class_processing (void);
03850 extern int is_empty_class (tree);
03851 extern void pushclass (tree);
03852 extern void popclass (void);
03853 extern void push_nested_class (tree);
03854 extern void pop_nested_class (void);
03855 extern int current_lang_depth (void);
03856 extern void push_lang_context (tree);
03857 extern void pop_lang_context (void);
03858 extern tree instantiate_type (tree, tree, tsubst_flags_t);
03859 extern void print_class_statistics (void);
03860 extern void cxx_print_statistics (void);
03861 extern void cxx_print_xnode (FILE *, tree, int);
03862 extern void cxx_print_decl (FILE *, tree, int);
03863 extern void cxx_print_type (FILE *, tree, int);
03864 extern void cxx_print_identifier (FILE *, tree, int);
03865 extern void cxx_print_error_function (struct diagnostic_context *,
03866 const char *);
03867 extern void build_self_reference (void);
03868 extern int same_signature_p (tree, tree);
03869 extern void maybe_add_class_template_decl_list (tree, tree, int);
03870 extern void unreverse_member_declarations (tree);
03871 extern void invalidate_class_lookup_cache (void);
03872 extern void maybe_note_name_used_in_class (tree, tree);
03873 extern void note_name_declared_in_class (tree, tree);
03874 extern tree get_vtbl_decl_for_binfo (tree);
03875 extern void debug_class (tree);
03876 extern void debug_thunks (tree);
03877 extern tree cp_fold_obj_type_ref (tree, tree);
03878 extern void set_linkage_according_to_type (tree, tree);
03879 extern void determine_key_method (tree);
03880 extern void check_for_override (tree, tree);
03881 extern void push_class_stack (void);
03882 extern void pop_class_stack (void);
03883
03884 /* in cvt.c */
03885 extern tree convert_to_reference (tree, tree, int, int, tree);
03886 extern tree convert_from_reference (tree);
03887 extern tree force_rvalue (tree);
03888 extern tree ocp_convert (tree, tree, int, int);
03889 extern tree cp_convert (tree, tree);
03890 extern tree convert_to_void (tree, const char */*implicit context*/);
03891 extern tree convert_force (tree, tree, int);
03892 extern tree build_expr_type_conversion (int, tree, bool);
03893 extern tree type_promotes_to (tree);
03894 extern tree perform_qualification_conversions (tree, tree);
03895 extern void clone_function_decl (tree, int);
03896 extern void adjust_clone_args (tree);
03897
03898 /* decl.c */
03899 extern tree poplevel (int, int, int);
03900 extern void insert_block (tree);
03901 extern tree pushdecl (tree);
03902 extern tree pushdecl_maybe_friend (tree, bool);
03903 extern void cxx_init_decl_processing (void);
03904 enum cp_tree_node_structure_enum cp_tree_node_structure
03905 (union lang_tree_node *);
03906 extern bool cxx_mark_addressable (tree);
03907 extern void cxx_push_function_context (struct function *);
03908 extern void cxx_pop_function_context (struct function *);
03909 extern void maybe_push_cleanup_level (tree);
03910 extern void finish_scope (void);
03911 extern void push_switch (tree);
03912 extern void pop_switch (void);
03913 extern tree pushtag (tree, tree, tag_scope);
03914 extern tree make_anon_name (void);
03915 extern int decls_match (tree, tree);
03916 extern tree duplicate_decls (tree, tree, bool);
03917 extern tree pushdecl_top_level_maybe_friend (tree, bool);
03918 extern tree pushdecl_top_level_and_finish (tree, tree);
03919 extern tree declare_local_label (tree);
03920 extern tree define_label (location_t, tree);
03921 extern void check_goto (tree);
03922 extern bool check_omp_return (void);
03923 extern tree make_typename_type (tree, tree, enum tag_types, tsubst_flags_t);
03924 extern tree make_unbound_class_template (tree, tree, tree, tsubst_flags_t);
03925 extern tree check_for_out_of_scope_variable (tree);
03926 extern tree build_library_fn (tree, tree);
03927 extern tree build_library_fn_ptr (const char *, tree);
03928 extern tree build_cp_library_fn_ptr (const char *, tree);
03929 extern tree push_library_fn (tree, tree);
03930 extern tree push_void_library_fn (tree, tree);
03931 extern tree push_throw_library_fn (tree, tree);
03932 extern tree check_tag_decl (cp_decl_specifier_seq *);
03933 extern tree shadow_tag (cp_decl_specifier_seq *);
03934 extern tree groktypename (cp_decl_specifier_seq *, const cp_declarator *);
03935 extern tree start_decl (const cp_declarator *, cp_decl_specifier_seq *, int, tree, tree, tree *);
03936 extern void start_decl_1 (tree, bool);
03937 extern void cp_finish_decl (tree, tree, bool, tree, int);
03938 extern void finish_decl (tree, tree, tree);
03939 extern int cp_complete_array_type (tree *, tree, bool);
03940 extern tree build_ptrmemfunc_type (tree);
03941 extern tree build_ptrmem_type (tree, tree);
03942 /* the grokdeclarator prototype is in decl.h */
03943 extern tree build_this_parm (tree, cp_cv_quals);
03944 extern int copy_fn_p (tree);
03945 extern tree get_scope_of_declarator (const cp_declarator *);
03946 extern void grok_special_member_properties (tree);
03947 extern int grok_ctor_properties (tree, tree);
03948 extern bool grok_op_properties (tree, bool);
03949 extern tree xref_tag (enum tag_types, tree, tag_scope, bool);
03950 extern tree xref_tag_from_type (tree, tree, tag_scope);
03951 extern bool xref_basetypes (tree, tree);
03952 extern tree start_enum (tree);
03953 extern void finish_enum (tree);
03954 extern void build_enumerator (tree, tree, tree);
03955 extern void start_preparsed_function (tree, tree, int);
03956 extern int start_function (cp_decl_specifier_seq *, const cp_declarator *, tree);
03957 extern tree begin_function_body (void);
03958 extern void finish_function_body (tree);
03959 extern tree finish_function (int);
03960 extern tree start_method (cp_decl_specifier_seq *, const cp_declarator *, tree);
03961 extern tree finish_method (tree);
03962 extern void maybe_register_incomplete_var (tree);
03963 extern void complete_vars (tree);
03964 extern void finish_stmt (void);
03965 extern void print_other_binding_stack (struct cp_binding_level *);
03966 extern void revert_static_member_fn (tree);
03967 extern void fixup_anonymous_aggr (tree);
03968 extern int check_static_variable_definition (tree, tree);
03969 extern tree compute_array_index_type (tree, tree);
03970 extern tree check_default_argument (tree, tree);
03971 typedef int (*walk_namespaces_fn) (tree, void *);
03972 extern int walk_namespaces (walk_namespaces_fn,
03973 void *);
03974 extern int wrapup_globals_for_namespace (tree, void *);
03975 extern tree create_implicit_typedef (tree, tree);
03976 extern tree maybe_push_decl (tree);
03977 extern tree force_target_expr (tree, tree);
03978 extern tree build_target_expr_with_type (tree, tree);
03979 extern int local_variable_p (tree);
03980 extern int nonstatic_local_decl_p (tree);
03981 extern tree register_dtor_fn (tree);
03982 extern tmpl_spec_kind current_tmpl_spec_kind (int);
03983 extern tree cp_fname_init (const char *, tree *);
03984 extern tree builtin_function (const char *name, tree type,
03985 int code,
03986 enum built_in_class cl,
03987 const char *libname,
03988 tree attrs);
03989 extern tree check_elaborated_type_specifier (enum tag_types, tree, bool);
03990 extern void warn_extern_redeclared_static (tree, tree);
03991 extern const char *cxx_comdat_group (tree);
03992 extern bool cp_missing_noreturn_ok_p (tree);
03993 extern void initialize_artificial_var (tree, tree);
03994 extern tree check_var_type (tree, tree);
03995 extern tree reshape_init (tree, tree);
03996
03997 /* in decl2.c */
03998 extern bool check_java_method (tree);
03999 extern tree build_memfn_type (tree, tree, cp_cv_quals);
04000 extern void maybe_retrofit_in_chrg (tree);
04001 extern void maybe_make_one_only (tree);
04002 extern void grokclassfn (tree, tree,
04003 enum overload_flags);
04004 extern tree grok_array_decl (tree, tree);
04005 extern tree delete_sanity (tree, tree, bool, int);
04006 extern tree check_classfn (tree, tree, tree);
04007 extern void check_member_template (tree);
04008 extern tree grokfield (const cp_declarator *, cp_decl_specifier_seq *,
04009 tree, bool, tree, tree);
04010 extern tree grokbitfield (const cp_declarator *, cp_decl_specifier_seq *,
04011 tree);
04012 extern void cplus_decl_attributes (tree *, tree, int);
04013 extern void finish_anon_union (tree);
04014 extern void cp_finish_file (void);
04015 extern tree coerce_new_type (tree);
04016 extern tree coerce_delete_type (tree);
04017 extern void comdat_linkage (tree);
04018 extern void determine_visibility (tree);
04019 extern void constrain_class_visibility (tree);
04020 extern void update_member_visibility (tree);
04021 extern void import_export_decl (tree);
04022 extern tree build_cleanup (tree);
04023 extern tree build_offset_ref_call_from_tree (tree, tree);
04024 extern void check_default_args (tree);
04025 extern void mark_used (tree);
04026 extern void finish_static_data_member_decl (tree, tree, bool, tree, int);
04027 extern tree cp_build_parm_decl (tree, tree);
04028 extern tree get_guard (tree);
04029 extern tree get_guard_cond (tree);
04030 extern tree set_guard (tree);
04031 extern tree cxx_callgraph_analyze_expr (tree *, int *, tree);
04032 extern void mark_needed (tree);
04033 extern bool decl_needed_p (tree);
04034 #ifdef KEY
04035 extern bool decl_maybe_needed_p (tree);
04036 #endif
04037 extern void note_vague_linkage_fn (tree);
04038 extern tree build_artificial_parm (tree, tree);
04039
04040 /* in error.c */
04041 extern void init_error (void);
04042 extern const char *type_as_string (tree, int);
04043 extern const char *decl_as_string (tree, int);
04044 extern const char *expr_as_string (tree, int);
04045 extern const char *lang_decl_name (tree, int);
04046 extern const char *language_to_string (enum languages);
04047 extern const char *class_key_or_enum_as_string (tree);
04048 extern void print_instantiation_context (void);
04049
04050 /* in except.c */
04051 extern void init_exception_processing (void);
04052 extern tree expand_start_catch_block (tree);
04053 extern void expand_end_catch_block (void);
04054 extern tree build_exc_ptr (void);
04055 extern tree build_throw (tree);
04056 extern int nothrow_libfn_p (tree);
04057 extern void check_handlers (tree);
04058 extern void choose_personality_routine (enum languages);
04059 extern tree eh_type_info (tree);
04060
04061 /* in expr.c */
04062 extern rtx cxx_expand_expr (tree, rtx,
04063 enum machine_mode,
04064 int, rtx *);
04065 extern tree cplus_expand_constant (tree);
04066
04067 /* friend.c */
04068 extern int is_friend (tree, tree);
04069 extern void make_friend_class (tree, tree, bool);
04070 extern void add_friend (tree, tree, bool);
04071 extern tree do_friend (tree, tree, tree, tree, enum overload_flags, bool);
04072
04073 /* in init.c */
04074 extern tree expand_member_init (tree);
04075 extern void emit_mem_initializers (tree);
04076 extern tree build_aggr_init (tree, tree, int);
04077 extern int is_aggr_type (tree, int);
04078 extern tree get_type_value (tree);
04079 extern tree build_zero_init (tree, tree, bool);
04080 extern tree build_offset_ref (tree, tree, bool);
04081 extern tree build_new (tree, tree, tree, tree, int);
04082 extern tree build_vec_init (tree, tree, tree, bool, int);
04083 extern tree build_delete (tree, tree,
04084 special_function_kind,
04085 int, int);
04086 extern void push_base_cleanups (void);
04087 extern tree build_vec_delete (tree, tree,
04088 special_function_kind, int);
04089 extern tree create_temporary_var (tree);
04090 extern void initialize_vtbl_ptrs (tree);
04091 extern tree build_java_class_ref (tree);
04092 extern tree integral_constant_value (tree);
04093
04094 /* in lex.c */
04095 extern void cxx_dup_lang_specific_decl (tree);
04096 extern void yyungetc (int, int);
04097
04098 extern tree unqualified_name_lookup_error (tree);
04099 extern tree unqualified_fn_lookup_error (tree);
04100 extern tree build_lang_decl (enum tree_code, tree, tree);
04101 extern void retrofit_lang_decl (tree);
04102 extern tree copy_decl (tree);
04103 extern tree copy_type (tree);
04104 extern tree cxx_make_type (enum tree_code);
04105 extern tree make_aggr_type (enum tree_code);
04106 extern void yyerror (const char *);
04107 extern void yyhook (int);
04108 extern bool cxx_init (void);
04109 extern void cxx_finish (void);
04110
04111 /* in method.c */
04112 extern void init_method (void);
04113 extern tree make_thunk (tree, bool, tree, tree);
04114 extern void finish_thunk (tree);
04115 extern void use_thunk (tree, bool);
04116 extern void synthesize_method (tree);
04117 extern tree lazily_declare_fn (special_function_kind,
04118 tree);
04119 extern tree skip_artificial_parms_for (tree, tree);
04120 extern tree make_alias_for (tree, tree);
04121
04122 /* In optimize.c */
04123 extern bool maybe_clone_body (tree);
04124
04125 /* in pt.c */
04126 extern void check_template_shadow (tree);
04127 extern tree get_innermost_template_args (tree, int);
04128 extern void maybe_begin_member_template_processing (tree);
04129 extern void maybe_end_member_template_processing (void);
04130 extern tree finish_member_template_decl (tree);
04131 extern void begin_template_parm_list (void);
04132 extern bool begin_specialization (void);
04133 extern void reset_specialization (void);
04134 extern void end_specialization (void);
04135 extern void begin_explicit_instantiation (void);
04136 extern void end_explicit_instantiation (void);
04137 extern tree check_explicit_specialization (tree, tree, int, int);
04138 extern tree process_template_parm (tree, tree, bool);
04139 extern tree end_template_parm_list (tree);
04140 extern void end_template_decl (void);
04141 extern tree push_template_decl (tree);
04142 extern tree push_template_decl_real (tree, bool);
04143 extern bool redeclare_class_template (tree, tree);
04144 extern tree lookup_template_class (tree, tree, tree, tree,
04145 int, tsubst_flags_t);
04146 extern tree lookup_template_function (tree, tree);
04147 extern int uses_template_parms (tree);
04148 extern int uses_template_parms_level (tree, int);
04149 extern tree instantiate_class_template (tree);
04150 extern tree instantiate_template (tree, tree, tsubst_flags_t);
04151 extern int fn_type_unification (tree, tree, tree, tree,
04152 tree, unification_kind_t, int);
04153 extern void mark_decl_instantiated (tree, int);
04154 extern int more_specialized_fn (tree, tree, int);
04155 extern void do_decl_instantiation (tree, tree);
04156 extern void do_type_instantiation (tree, tree, tsubst_flags_t);
04157 extern tree instantiate_decl (tree, int, bool);
04158 extern int comp_template_parms (tree, tree);
04159 extern int template_class_depth (tree);
04160 extern int is_specialization_of (tree, tree);
04161 extern bool is_specialization_of_friend (tree, tree);
04162 extern int comp_template_args (tree, tree);
04163 extern tree maybe_process_partial_specialization (tree);
04164 extern tree most_specialized_instantiation (tree);
04165 extern void print_candidates (tree);
04166 extern void instantiate_pending_templates (int);
04167 extern tree tsubst_default_argument (tree, tree, tree);
04168 extern tree tsubst_copy_and_build (tree, tree, tsubst_flags_t,
04169 tree, bool, bool);
04170 extern tree most_general_template (tree);
04171 extern tree get_mostly_instantiated_function_type (tree);
04172 extern int problematic_instantiation_changed (void);
04173 extern void record_last_problematic_instantiation (void);
04174 extern tree current_instantiation (void);
04175 extern tree maybe_get_template_decl_from_type_decl (tree);
04176 extern int processing_template_parmlist;
04177 extern bool dependent_type_p (tree);
04178 extern bool any_dependent_template_arguments_p (tree);
04179 extern bool dependent_template_p (tree);
04180 extern bool dependent_template_id_p (tree, tree);
04181 extern bool type_dependent_expression_p (tree);
04182 extern bool any_type_dependent_arguments_p (tree);
04183 extern bool value_dependent_expression_p (tree);
04184 extern tree resolve_typename_type (tree, bool);
04185 extern tree template_for_substitution (tree);
04186 extern tree build_non_dependent_expr (tree);
04187 extern tree build_non_dependent_args (tree);
04188 extern bool reregister_specialization (tree, tree, tree);
04189 extern tree fold_non_dependent_expr (tree);
04190 extern bool explicit_class_specialization_p (tree);
04191
04192 /* in repo.c */
04193 extern void init_repo (void);
04194 extern int repo_emit_p (tree);
04195 extern bool repo_export_class_p (tree);
04196 extern void finish_repo (void);
04197
04198 /* in rtti.c */
04199 /* A vector of all tinfo decls that haven't been emitted yet. */
04200 extern GTY(()) VEC(tree,gc) *unemitted_tinfo_decls;
04201
04202 extern void init_rtti_processing (void);
04203 extern tree build_typeid (tree);
04204 extern tree get_tinfo_decl (tree);
04205 extern tree get_typeid (tree);
04206 extern tree build_dynamic_cast (tree, tree);
04207 extern void emit_support_tinfos (void);
04208 extern bool emit_tinfo_decl (tree);
04209
04210 /* in search.c */
04211 extern bool accessible_base_p (tree, tree, bool);
04212 extern tree lookup_base (tree, tree, base_access,
04213 base_kind *);
04214 extern tree dcast_base_hint (tree, tree);
04215 extern int accessible_p (tree, tree, bool);
04216 extern tree lookup_field_1 (tree, tree, bool);
04217 extern tree lookup_field (tree, tree, int, bool);
04218 extern int lookup_fnfields_1 (tree, tree);
04219 extern int class_method_index_for_fn (tree, tree);
04220 extern tree lookup_fnfields (tree, tree, int);
04221 extern tree lookup_member (tree, tree, int, bool);
04222 extern int look_for_overrides (tree, tree);
04223 extern void get_pure_virtuals (tree);
04224 extern void maybe_suppress_debug_info (tree);
04225 extern void note_debug_info_needed (tree);
04226 extern void print_search_statistics (void);
04227 extern void reinit_search_statistics (void);
04228 extern tree current_scope (void);
04229 extern int at_function_scope_p (void);
04230 extern bool at_class_scope_p (void);
04231 extern bool at_namespace_scope_p (void);
04232 extern tree context_for_name_lookup (tree);
04233 extern tree lookup_conversions (tree);
04234 extern tree binfo_from_vbase (tree);
04235 extern tree binfo_for_vbase (tree, tree);
04236 extern tree look_for_overrides_here (tree, tree);
04237 #define dfs_skip_bases ((tree)1)
04238 extern tree dfs_walk_all (tree, tree (*) (tree, void *),
04239 tree (*) (tree, void *), void *);
04240 extern tree dfs_walk_once (tree, tree (*) (tree, void *),
04241 tree (*) (tree, void *), void *);
04242 extern tree binfo_via_virtual (tree, tree);
04243 extern tree build_baselink (tree, tree, tree, tree);
04244 extern tree adjust_result_of_qualified_name_lookup
04245 (tree, tree, tree);
04246 extern tree copied_binfo (tree, tree);
04247 extern tree original_binfo (tree, tree);
04248 extern int shared_member_p (tree);
04249
04250
04251 /* The representation of a deferred access check. */
04252
04253 typedef struct deferred_access_check GTY(())
04254 {
04255 /* The base class in which the declaration is referenced. */
04256 tree binfo;
04257 /* The declaration whose access must be checked. */
04258 tree decl;
04259 /* The declaration that should be used in the error message. */
04260 tree diag_decl;
04261 } deferred_access_check;
04262 DEF_VEC_O(deferred_access_check);
04263 DEF_VEC_ALLOC_O(deferred_access_check,gc);
04264
04265 /* in semantics.c */
04266 extern void push_deferring_access_checks (deferring_kind);
04267 extern void resume_deferring_access_checks (void);
04268 extern void stop_deferring_access_checks (void);
04269 extern void pop_deferring_access_checks (void);
04270 extern VEC (deferred_access_check,gc)* get_deferred_access_checks (void);
04271 extern void pop_to_parent_deferring_access_checks (void);
04272 extern void perform_access_checks (VEC (deferred_access_check,gc)*);
04273 extern void perform_deferred_access_checks (void);
04274 extern void perform_or_defer_access_check (tree, tree, tree);
04275 extern int stmts_are_full_exprs_p (void);
04276 extern void init_cp_semantics (void);
04277 extern tree do_poplevel (tree);
04278 extern void add_decl_expr (tree);
04279 extern tree finish_expr_stmt (tree);
04280 extern tree begin_if_stmt (void);
04281 extern void finish_if_stmt_cond (tree, tree);
04282 extern tree finish_then_clause (tree);
04283 extern void begin_else_clause (tree);
04284 extern void finish_else_clause (tree);
04285 extern void finish_if_stmt (tree);
04286 extern tree begin_while_stmt (void);
04287 extern void finish_while_stmt_cond (tree, tree);
04288 extern void finish_while_stmt (tree);
04289 extern tree begin_do_stmt (void);
04290 extern void finish_do_body (tree);
04291 extern void finish_do_stmt (tree, tree);
04292 extern tree finish_return_stmt (tree);
04293 extern tree begin_for_stmt (void);
04294 extern void finish_for_init_stmt (tree);
04295 extern void finish_for_cond (tree, tree);
04296 extern void finish_for_expr (tree, tree);
04297 extern void finish_for_stmt (tree);
04298 extern tree finish_break_stmt (void);
04299 extern tree finish_continue_stmt (void);
04300 extern tree begin_switch_stmt (void);
04301 extern void finish_switch_cond (tree, tree);
04302 extern void finish_switch_stmt (tree);
04303 extern tree finish_case_label (tree, tree);
04304 extern tree finish_goto_stmt (tree);
04305 extern tree begin_try_block (void);
04306 extern void finish_try_block (tree);
04307 extern tree begin_eh_spec_block (void);
04308 extern void finish_eh_spec_block (tree, tree);
04309 extern void finish_handler_sequence (tree);
04310 extern tree begin_function_try_block (tree *);
04311 extern void finish_function_try_block (tree);
04312 extern void finish_function_handler_sequence (tree, tree);
04313 extern void finish_cleanup_try_block (tree);
04314 extern tree begin_handler (void);
04315 extern void finish_handler_parms (tree, tree);
04316 extern void finish_handler (tree);
04317 extern void finish_cleanup (tree, tree);
04318
04319 enum {
04320 BCS_NO_SCOPE = 1,
04321 BCS_TRY_BLOCK = 2,
04322 BCS_FN_BODY = 4
04323 };
04324 extern tree begin_compound_stmt (unsigned int);
04325
04326 extern void finish_compound_stmt (tree);
04327 extern tree finish_asm_stmt (int, tree, tree, tree, tree);
04328 extern tree finish_label_stmt (tree);
04329 extern void finish_label_decl (tree);
04330 extern tree finish_parenthesized_expr (tree);
04331 extern tree finish_non_static_data_member (tree, tree, tree);
04332 extern tree begin_stmt_expr (void);
04333 extern tree finish_stmt_expr_expr (tree, tree);
04334 extern tree finish_stmt_expr (tree, bool);
04335 extern tree perform_koenig_lookup (tree, tree);
04336 extern tree finish_call_expr (tree, tree, bool, bool);
04337 extern tree finish_increment_expr (tree, enum tree_code);
04338 extern tree finish_this_expr (void);
04339 extern tree finish_pseudo_destructor_expr (tree, tree, tree);
04340 extern tree finish_unary_op_expr (enum tree_code, tree);
04341 extern tree finish_compound_literal (tree, VEC(constructor_elt,gc) *);
04342 extern tree finish_fname (tree);
04343 extern void finish_translation_unit (void);
04344 extern tree finish_template_type_parm (tree, tree);
04345 extern tree finish_template_template_parm (tree, tree);
04346 extern tree begin_class_definition (tree, tree);
04347 extern void finish_template_decl (tree);
04348 extern tree finish_template_type (tree, tree, int);
04349 extern tree finish_base_specifier (tree, tree, bool);
04350 extern void finish_member_declaration (tree);
04351 extern void qualified_name_lookup_error (tree, tree, tree);
04352 extern void check_template_keyword (tree);
04353 extern tree finish_id_expression (tree, tree, tree,
04354 cp_id_kind *,
04355 bool, bool, bool *,
04356 bool, bool, bool, bool,
04357 const char **);
04358 extern tree finish_typeof (tree);
04359 extern tree finish_offsetof (tree);
04360 extern void finish_decl_cleanup (tree, tree);
04361 extern void finish_eh_cleanup (tree);
04362 extern void expand_body (tree);
04363 extern void finish_mem_initializers (tree);
04364 extern tree check_template_template_default_arg (tree);
04365 extern void expand_or_defer_fn (tree);
04366 extern void check_accessibility_of_qualified_id (tree, tree, tree);
04367 extern tree finish_qualified_id_expr (tree, tree, bool, bool,
04368 bool, bool);
04369 extern void simplify_aggr_init_expr (tree *);
04370 extern void finalize_nrv (tree *, tree, tree);
04371 extern void note_decl_for_pch (tree);
04372 extern tree finish_omp_clauses (tree);
04373 extern void finish_omp_threadprivate (tree);
04374 extern tree begin_omp_structured_block (void);
04375 extern tree finish_omp_structured_block (tree);
04376 extern tree begin_omp_parallel (void);
04377 extern tree finish_omp_parallel (tree, tree);
04378 extern tree finish_omp_for (location_t, tree, tree,
04379 tree, tree, tree, tree);
04380 extern void finish_omp_atomic (enum tree_code, tree, tree);
04381 extern void finish_omp_barrier (void);
04382 extern void finish_omp_flush (void);
04383 extern enum omp_clause_default_kind cxx_omp_predetermined_sharing (tree);
04384 extern tree cxx_omp_clause_default_ctor (tree, tree);
04385 extern tree cxx_omp_clause_copy_ctor (tree, tree, tree);
04386 extern tree cxx_omp_clause_assign_op (tree, tree, tree);
04387 extern tree cxx_omp_clause_dtor (tree, tree);
04388 extern bool cxx_omp_privatize_by_reference (tree);
04389 extern tree baselink_for_fns (tree);
04390
04391 /* in tree.c */
04392 extern void lang_check_failed (const char *, int,
04393 const char *) ATTRIBUTE_NORETURN;
04394 extern tree stabilize_expr (tree, tree *);
04395 extern void stabilize_call (tree, tree *);
04396 extern bool stabilize_init (tree, tree *);
04397 extern tree add_stmt_to_compound (tree, tree);
04398 extern tree cxx_maybe_build_cleanup (tree);
04399 extern void init_tree (void);
04400 extern int pod_type_p (tree);
04401 extern int zero_init_p (tree);
04402 extern tree canonical_type_variant (tree);
04403 extern tree copy_binfo (tree, tree, tree,
04404 tree *, int);
04405 extern int member_p (tree);
04406 extern cp_lvalue_kind real_lvalue_p (tree);
04407 extern bool builtin_valid_in_constant_expr_p (tree);
04408 extern tree build_min (enum tree_code, tree, ...);
04409 extern tree build_min_nt (enum tree_code, ...);
04410 extern tree build_min_non_dep (enum tree_code, tree, ...);
04411 extern tree build_cplus_new (tree, tree);
04412 extern tree get_target_expr (tree);
04413 extern tree build_cplus_array_type (tree, tree);
04414 extern tree hash_tree_cons (tree, tree, tree);
04415 extern tree hash_tree_chain (tree, tree);
04416 extern tree build_qualified_name (tree, tree, tree, bool);
04417 extern int is_overloaded_fn (tree);
04418 extern tree get_first_fn (tree);
04419 extern tree ovl_cons (tree, tree);
04420 extern tree build_overload (tree, tree);
04421 extern const char *cxx_printable_name (tree, int);
04422 extern tree build_exception_variant (tree, tree);
04423 extern tree bind_template_template_parm (tree, tree);
04424 extern tree array_type_nelts_total (tree);
04425 extern tree array_type_nelts_top (tree);
04426 extern tree break_out_target_exprs (tree);
04427 extern tree get_type_decl (tree);
04428 extern tree decl_namespace_context (tree);
04429 extern bool decl_anon_ns_mem_p (tree);
04430 extern tree lvalue_type (tree);
04431 extern tree error_type (tree);
04432 extern int varargs_function_p (tree);
04433 extern bool really_overloaded_fn (tree);
04434 extern bool cp_tree_equal (tree, tree);
04435 extern tree no_linkage_check (tree, bool);
04436 extern void debug_binfo (tree);
04437 extern tree build_dummy_object (tree);
04438 extern tree maybe_dummy_object (tree, tree *);
04439 extern int is_dummy_object (tree);
04440 extern const struct attribute_spec cxx_attribute_table[];
04441 extern tree make_ptrmem_cst (tree, tree);
04442 extern tree cp_build_type_attribute_variant (tree, tree);
04443 extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t);
04444 #define cp_build_qualified_type(TYPE, QUALS) \
04445 cp_build_qualified_type_real ((TYPE), (QUALS), tf_warning_or_error)
04446 extern special_function_kind special_function_p (tree);
04447 extern int count_trees (tree);
04448 extern int char_type_p (tree);
04449 extern void verify_stmt_tree (tree);
04450 extern linkage_kind decl_linkage (tree);
04451 extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn,
04452 void*, struct pointer_set_t*);
04453 extern int cp_cannot_inline_tree_fn (tree*);
04454 extern tree cp_add_pending_fn_decls (void*,tree);
04455 extern int cp_auto_var_in_fn_p (tree,tree);
04456 extern tree fold_if_not_in_template (tree);
04457 extern tree rvalue (tree);
04458 extern tree convert_bitfield_to_declared_type (tree);
04459 extern tree cp_save_expr (tree);
04460 extern bool cast_valid_in_integral_constant_expression_p (tree);
04461
04462 /* in typeck.c */
04463 extern int string_conv_p (tree, tree, int);
04464 extern tree cp_truthvalue_conversion (tree);
04465 extern tree condition_conversion (tree);
04466 extern tree require_complete_type (tree);
04467 extern tree complete_type (tree);
04468 extern tree complete_type_or_else (tree, tree);
04469 extern int type_unknown_p (tree);
04470 extern bool comp_except_specs (tree, tree, bool);
04471 extern bool comptypes (tree, tree, int);
04472 extern bool compparms (tree, tree);
04473 extern int comp_cv_qualification (tree, tree);
04474 extern int comp_cv_qual_signature (tree, tree);
04475 extern tree cxx_sizeof_or_alignof_expr (tree, enum tree_code);
04476 extern tree cxx_sizeof_or_alignof_type (tree, enum tree_code, bool);
04477 #define cxx_sizeof_nowarn(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, false)
04478 extern tree inline_conversion (tree);
04479 extern tree is_bitfield_expr_with_lowered_type (tree);
04480 extern tree unlowered_expr_type (tree);
04481 extern tree decay_conversion (tree);
04482 extern tree build_class_member_access_expr (tree, tree, tree, bool);
04483 extern tree finish_class_member_access_expr (tree, tree, bool);
04484 extern tree build_x_indirect_ref (tree, const char *);
04485 extern tree build_indirect_ref (tree, const char *);
04486 extern tree build_array_ref (tree, tree);
04487 extern tree get_member_function_from_ptrfunc (tree *, tree);
04488 extern tree build_x_binary_op (enum tree_code, tree, tree,
04489 bool *);
04490 extern tree build_x_unary_op (enum tree_code, tree);
04491 extern tree unary_complex_lvalue (enum tree_code, tree);
04492 extern tree build_x_conditional_expr (tree, tree, tree);
04493 extern tree build_x_compound_expr_from_list (tree, const char *);
04494 extern tree build_x_compound_expr (tree, tree);
04495 extern tree build_compound_expr (tree, tree);
04496 extern tree build_static_cast (tree, tree);
04497 extern tree build_reinterpret_cast (tree, tree);
04498 extern tree build_const_cast (tree, tree);
04499 extern tree build_c_cast (tree, tree);
04500 extern tree build_x_modify_expr (tree, enum tree_code, tree);
04501 extern tree build_modify_expr (tree, enum tree_code, tree);
04502 extern tree convert_for_initialization (tree, tree, tree, int,
04503 const char *, tree, int);
04504 extern int comp_ptr_ttypes (tree, tree);
04505 extern bool comp_ptr_ttypes_const (tree, tree);
04506 extern int ptr_reasonably_similar (tree, tree);
04507 extern tree build_ptrmemfunc (tree, tree, int, bool);
04508 extern int cp_type_quals (tree);
04509 extern bool cp_type_readonly (tree);
04510 extern bool cp_has_mutable_p (tree);
04511 extern bool at_least_as_qualified_p (tree, tree);
04512 extern void cp_apply_type_quals_to_decl (int, tree);
04513 extern tree build_ptrmemfunc1 (tree, tree, tree);
04514 extern void expand_ptrmemfunc_cst (tree, tree *, tree *);
04515 extern tree type_after_usual_arithmetic_conversions (tree, tree);
04516 extern tree composite_pointer_type (tree, tree, tree, tree,
04517 const char*);
04518 extern tree merge_types (tree, tree);
04519 extern tree check_return_expr (tree, bool *);
04520 #define cp_build_binary_op(code, arg1, arg2) \
04521 build_binary_op(code, arg1, arg2, 1)
04522 #define cxx_sizeof(T) cxx_sizeof_or_alignof_type (T, SIZEOF_EXPR, true)
04523 extern tree build_ptrmemfunc_access_expr (tree, tree);
04524 extern tree build_address (tree);
04525 extern tree build_nop (tree, tree);
04526 extern tree non_reference (tree);
04527 extern tree lookup_anon_field (tree, tree);
04528 extern bool invalid_nonstatic_memfn_p (tree);
04529 extern tree convert_member_func_to_ptr (tree, tree);
04530 extern tree convert_ptrmem (tree, tree, bool, bool);
04531 extern int lvalue_or_else (tree, enum lvalue_use);
04532 extern int lvalue_p (tree);
04533
04534 /* in typeck2.c */
04535 extern void require_complete_eh_spec_types (tree, tree);
04536 extern void cxx_incomplete_type_diagnostic (tree, tree, int);
04537 #undef cxx_incomplete_type_error
04538 extern void cxx_incomplete_type_error (tree, tree);
04539 #define cxx_incomplete_type_error(V,T) \
04540 (cxx_incomplete_type_diagnostic ((V), (T), 0))
04541 extern tree error_not_base_type (tree, tree);
04542 extern tree binfo_or_else (tree, tree);
04543 extern void readonly_error (tree, const char *, int);
04544 extern void complete_type_check_abstract (tree);
04545 extern int abstract_virtuals_error (tree, tree);
04546
04547 extern tree store_init_value (tree, tree);
04548 extern tree digest_init (tree, tree);
04549 extern tree build_scoped_ref (tree, tree, tree *);
04550 extern tree build_x_arrow (tree);
04551 extern tree build_m_component_ref (tree, tree);
04552 extern tree build_functional_cast (tree, tree);
04553 extern tree add_exception_specifier (tree, tree, int);
04554 extern tree merge_exception_specifiers (tree, tree);
04555
04556 /* in mangle.c */
04557 extern void init_mangle (void);
04558 extern void mangle_decl (tree);
04559 extern const char *mangle_type_string (tree);
04560 extern tree mangle_typeinfo_for_type (tree);
04561 extern tree mangle_typeinfo_string_for_type (tree);
04562 extern tree mangle_vtbl_for_type (tree);
04563 extern tree mangle_vtt_for_type (tree);
04564 extern tree mangle_ctor_vtbl_for_type (tree, tree);
04565 extern tree mangle_thunk (tree, int, tree, tree);
04566 extern tree mangle_conv_op_name_for_type (tree);
04567 extern tree mangle_guard_variable (tree);
04568 extern tree mangle_ref_init_variable (tree);
04569
04570 /* in dump.c */
04571 extern bool cp_dump_tree (void *, tree);
04572
04573 /* In cp/cp-objcp-common.c. */
04574
04575 extern HOST_WIDE_INT cxx_get_alias_set (tree);
04576 extern bool cxx_warn_unused_global_decl (tree);
04577 extern tree cp_expr_size (tree);
04578 extern size_t cp_tree_size (enum tree_code);
04579 extern bool cp_var_mod_type_p (tree, tree);
04580 extern void cxx_initialize_diagnostics (struct diagnostic_context *);
04581 extern int cxx_types_compatible_p (tree, tree);
04582 extern void init_shadowed_var_for_decl (void);
04583 extern tree cxx_staticp (tree);
04584
04585 /* in cp-gimplify.c */
04586 extern int cp_gimplify_expr (tree *, tree *, tree *);
04587 extern void cp_genericize (tree);
04588
04589 /* -- end of C++ */
04590
04591 /* In order for the format checking to accept the C++ frontend
04592 diagnostic framework extensions, you must include this file before
04593 toplev.h, not after. We override the definition of GCC_DIAG_STYLE
04594 in c-common.h. */
04595 #undef GCC_DIAG_STYLE
04596 #define GCC_DIAG_STYLE __gcc_cxxdiag__
04597 #if GCC_VERSION >= 4001
04598 #define ATTRIBUTE_GCC_CXXDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
04599 #else
04600 #define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m)
04601 #endif
04602 extern void cp_cpp_error (cpp_reader *, int,
04603 const char *, va_list *)
04604 ATTRIBUTE_GCC_CXXDIAG(3,0);
04605
04606 #endif /* ! GCC_CP_TREE_H */