6: BINFO_ACCESS (in BINFO)
Usage of TYPE_LANG_FLAG_?:
- 0: C_TYPE_FIELDS_READONLY (in RECORD_TYPE or UNION_TYPE).
+ 0: TYPE_DEPENDENT_P
1: TYPE_HAS_CONSTRUCTOR.
2: TYPE_HAS_DESTRUCTOR.
3: TYPE_FOR_JAVA.
4: TYPE_HAS_NONTRIVIAL_DESTRUCTOR
5: IS_AGGR_TYPE.
- 6: TYPE_BUILT_IN.
+ 6: TYPE_DEPENDENT_P_VALID
Usage of DECL_LANG_FLAG_?:
0: DECL_ERROR_REPORTED (in VAR_DECL).
tree error_locus;
};
-typedef struct flagged_type_tree_s GTY(())
-{
- tree t;
- int new_type_flag;
- tree lookups;
-} flagged_type_tree;
-
typedef struct template_parm_index_s GTY(())
{
struct tree_common common;
(TREE_CODE (NODE) == BASELINK)
/* The BINFO indicating the base from which the BASELINK_FUNCTIONS came. */
#define BASELINK_BINFO(NODE) \
- (TREE_OPERAND (BASELINK_CHECK (NODE), 0))
+ (((struct tree_baselink*) BASELINK_CHECK (NODE))->binfo)
/* The functions referred to by the BASELINK; either a FUNCTION_DECL,
a TEMPLATE_DECL, an OVERLOAD, or a TEMPLATE_ID_EXPR. */
#define BASELINK_FUNCTIONS(NODE) \
- (TREE_OPERAND (BASELINK_CHECK (NODE), 1))
+ (((struct tree_baselink*) BASELINK_CHECK (NODE))->functions)
/* The BINFO in which the search for the functions indicated by this baselink
began. This base is used to determine the accessibility of functions
selected by overload resolution. */
#define BASELINK_ACCESS_BINFO(NODE) \
- (TREE_OPERAND (BASELINK_CHECK (NODE), 2))
+ (((struct tree_baselink*) BASELINK_CHECK (NODE))->access_binfo)
/* For a type-conversion operator, the BASELINK_OPTYPE indicates the type
to which the conversion should occur. This value is important if
the BASELINK_FUNCTIONS include a template conversion operator --
#define BASELINK_OPTYPE(NODE) \
(TREE_CHAIN (BASELINK_CHECK (NODE)))
+struct tree_baselink GTY(())
+{
+ struct tree_common common;
+ tree binfo;
+ tree functions;
+ tree access_binfo;
+};
+
#define WRAPPER_ZC(NODE) (((struct tree_wrapper*)WRAPPER_CHECK (NODE))->z_c)
struct tree_wrapper GTY(())
TREE_LANG_FLAG_3 (NODE)
/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
-#define C_TYPE_FIELDS_READONLY(TYPE) TYPE_LANG_FLAG_0 (TYPE)
+#define C_TYPE_FIELDS_READONLY(TYPE) \
+ (LANG_TYPE_CLASS_CHECK (TYPE)->fields_readonly)
/* Store a value in that field. */
#define C_SET_EXP_ORIGINAL_CODE(EXP, CODE) \
TS_CP_PTRMEM,
TS_CP_BINDING,
TS_CP_OVERLOAD,
+ TS_CP_BASELINK,
TS_CP_WRAPPER,
TS_CP_SRCLOC,
TS_CP_DEFAULT_ARG,
struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
struct tree_binding GTY ((tag ("TS_CP_BINDING"))) binding;
struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
+ struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
struct tree_wrapper GTY ((tag ("TS_CP_WRAPPER"))) wrapper;
struct tree_srcloc GTY ((tag ("TS_CP_SRCLOC"))) srcloc;
struct tree_default_arg GTY ((tag ("TS_CP_DEFAULT_ARG"))) default_arg;
tree x_previous_class_type;
tree x_previous_class_values;
tree x_saved_tree;
- tree lookups;
tree last_parms;
HOST_WIDE_INT x_processing_template_decl;
/* A list of private types mentioned, for deferred access checking. */
-#define type_lookups scope_chain->lookups
-
extern GTY(()) struct saved_scope *scope_chain;
/* Global state pertinent to the current function. */
(CLASS_TYPE_P (T) || TREE_CODE (T) == ENUMERAL_TYPE)
#define IS_OVERLOAD_TYPE(T) TAGGED_TYPE_P (T)
-/* In a *_TYPE, nonzero means a built-in type. */
-#define TYPE_BUILT_IN(NODE) TYPE_LANG_FLAG_6 (NODE)
-
/* True if this a "Java" type, defined in 'extern "Java"'. */
#define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3 (NODE)
+/* True if this type is dependent. This predicate is only valid if
+ TYPE_DEPENDENT_P_VALID is true. */
+#define TYPE_DEPENDENT_P(NODE) TYPE_LANG_FLAG_0 (NODE)
+
+/* True if dependent_type_p has been called for this type, with the
+ result that TYPE_DEPENDENT_P is valid. */
+#define TYPE_DEPENDENT_P_VALID(NODE) TYPE_LANG_FLAG_6(NODE)
+
/* Nonzero if this type is const-qualified. */
#define CP_TYPE_CONST_P(NODE) \
((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0)
unsigned has_arrow_overloaded : 1;
unsigned interface_only : 1;
unsigned interface_unknown : 1;
+ unsigned contains_empty_class_p : 1;
unsigned marks: 6;
unsigned vec_new_uses_cookie : 1;
unsigned has_complex_assign_ref : 1;
unsigned has_abstract_assign_ref : 1;
unsigned non_aggregate : 1;
- unsigned is_partial_instantiation : 1;
unsigned java_interface : 1;
-
unsigned anon_aggr : 1;
+
unsigned non_zero_init : 1;
unsigned empty_p : 1;
- unsigned contains_empty_class_p : 1;
+ unsigned fields_readonly : 1;
/* When adding a flag here, consider whether or not it ought to
apply to a template instance if it applies to the template. If
TEMPLATE_ID_EXPR if we had something like `typename X::Y<T>'. */
#define TYPENAME_TYPE_FULLNAME(NODE) (TYPE_FIELDS (NODE))
-/* Nonzero if NODE is an implicit typename. */
-#define IMPLICIT_TYPENAME_P(NODE) \
- (TREE_CODE (NODE) == TYPENAME_TYPE && TREE_TYPE (NODE))
-
-/* Nonzero if NODE is a TYPE_DECL that should not be visible because
- it is from a dependent base class. */
-#define IMPLICIT_TYPENAME_TYPE_DECL_P(NODE) \
- (TREE_CODE (NODE) == TYPE_DECL \
- && DECL_ARTIFICIAL (NODE) \
- && IMPLICIT_TYPENAME_P (TREE_TYPE (NODE)))
-
/* Nonzero in INTEGER_CST means that this int is negative by dint of
using a twos-complement negated operand. */
#define TREE_NEGATED_INT(NODE) TREE_LANG_FLAG_0 (INTEGER_CST_CHECK (NODE))
(TREE_CODE (TYPE) == BOOLEAN_TYPE \
|| TREE_CODE (TYPE) == INTEGER_TYPE)
+/* Returns true if TYPE is an integral or enumeration name. */
+#define INTEGRAL_OR_ENUMERATION_TYPE_P(TYPE) \
+ (CP_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == ENUMERAL_TYPE)
+
/* [basic.fundamental]
Integral and floating types are collectively called arithmetic
#define DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION(DECL) \
(DECL_TEMPLATE_INFO (DECL) && !DECL_USE_TEMPLATE (DECL))
-/* Nonzero if TYPE is a partial instantiation of a template class,
- i.e., an instantiation whose instantiation arguments involve
- template types. */
-#define PARTIAL_INSTANTIATION_P(TYPE) \
- (LANG_TYPE_CLASS_CHECK (TYPE)->is_partial_instantiation)
-
/* Nonzero iff we are currently processing a declaration for an
entity with its own template parameter list, and which is not a
full specialization. */
function, two inside the body of a function in a local class, etc.) */
extern int function_depth;
+typedef struct deferred_access GTY(())
+{
+ /* A TREE_LIST representing name-lookups for which we have deferred
+ checking access controls. We cannot check the accessibility of
+ names used in a decl-specifier-seq until we know what is being
+ declared because code like:
+
+ class A {
+ class B {};
+ B* f();
+ }
+
+ A::B* A::f() { return 0; }
+
+ is valid, even though `A::B' is not generally accessible.
+
+ The TREE_PURPOSE of each node is the scope used to qualify the
+ name being looked up; the TREE_VALUE is the DECL to which the
+ name was resolved. */
+ tree deferred_access_checks;
+ /* TRUE iff we are deferring access checks. */
+ bool deferring_access_checks_p;
+ /* The next deferred access data in stack or linked-list. */
+ struct deferred_access *next;
+} deferred_access;
+
/* in pt.c */
/* These values are used for the `STRICT' parameter to type_unification and
extern int resolves_to_fixed_type_p (tree, int *);
extern void init_class_processing (void);
extern int is_empty_class (tree);
-extern void pushclass (tree, int);
+extern void pushclass (tree, bool);
extern void popclass (void);
-extern void push_nested_class (tree, int);
+extern void push_nested_class (tree);
extern void pop_nested_class (void);
extern int current_lang_depth (void);
extern void push_lang_context (tree);
extern tree namespace_binding (tree, tree);
extern void set_namespace_binding (tree, tree, tree);
extern tree lookup_namespace_name (tree, tree);
-extern tree build_typename_type (tree, tree, tree, tree);
extern tree make_typename_type (tree, tree, tsubst_flags_t);
extern tree make_unbound_class_template (tree, tree, tsubst_flags_t);
extern tree lookup_name_nonclass (tree);
extern tree build_ptrmemfunc_type (tree);
extern tree build_ptrmem_type (tree, tree);
/* the grokdeclarator prototype is in decl.h */
-extern int parmlist_is_exprlist (tree);
extern int copy_fn_p (tree);
extern tree get_scope_of_declarator (tree);
extern void grok_special_member_properties (tree);
extern tree grokfield (tree, tree, tree, tree, tree);
extern tree grokbitfield (tree, tree, tree);
extern tree groktypefield (tree, tree);
-extern tree grokoptypename (tree, tree, tree);
extern void cplus_decl_attributes (tree *, tree, int);
extern tree constructor_name_full (tree);
extern tree constructor_name (tree);
extern tree build_cleanup (tree);
extern void finish_file (void);
extern tree build_expr_from_tree (tree);
-extern tree build_cleanup PARAMS ((tree));
-extern void finish_file PARAMS ((void));
-extern tree build_expr_from_tree PARAMS ((tree));
+extern tree build_cleanup (tree);
+extern void finish_file (void);
+extern tree build_expr_from_tree (tree);
extern tree build_offset_ref_call_from_tree (tree, tree);
extern tree build_call_from_tree (tree, tree, bool);
extern void set_decl_namespace (tree, tree, bool);
extern tree build_offset_ref (tree, tree);
extern tree resolve_offset_ref (tree);
extern tree build_new (tree, tree, tree, int);
-extern tree build_vec_init (tree, tree, int);
+extern tree build_vec_init (tree, tree, tree, int);
extern tree build_x_delete (tree, int, tree);
extern tree build_delete (tree, tree, special_function_kind, int, int);
extern void push_base_cleanups (void);
/* in method.c */
extern void init_method (void);
extern void set_mangled_name_for_decl (tree);
-extern tree build_opfncall (enum tree_code, int, tree, tree, tree);
extern tree hack_identifier (tree, tree);
extern tree make_thunk (tree, bool, tree, tree);
extern void finish_thunk (tree);
/* in pt.c */
extern void check_template_shadow (tree);
extern tree get_innermost_template_args (tree, int);
-extern tree tsubst (tree, tree, tsubst_flags_t, tree);
-extern tree tsubst_expr (tree, tree, tsubst_flags_t, tree);
-extern tree tsubst_copy (tree, tree, tsubst_flags_t, tree);
extern void maybe_begin_member_template_processing (tree);
extern void maybe_end_member_template_processing (void);
extern tree finish_member_template_decl (tree);
extern tree current_instantiation (void);
extern tree maybe_get_template_decl_from_type_decl (tree);
extern int processing_template_parmlist;
+extern bool dependent_type_p (tree);
+extern bool dependent_template_arg_p (tree);
+extern bool dependent_template_p (tree);
+extern bool type_dependent_expression_p (tree);
+extern bool value_dependent_expression_p (tree);
+extern tree resolve_typename_type (tree, bool);
+extern tree resolve_typename_type_in_current_instantiation (tree);
/* in repo.c */
extern void repo_template_used (tree);
extern int types_overlap_p (tree, tree);
extern tree get_vbase (tree, tree);
extern tree get_dynamic_cast_base_type (tree, tree);
-extern void type_access_control (tree, tree);
extern int accessible_p (tree, tree);
extern tree lookup_field (tree, tree, int, int);
extern int lookup_fnfields_1 (tree, tree);
extern tree adjust_result_of_qualified_name_lookup
(tree, tree, tree);
/* in semantics.c */
+extern void push_deferring_access_checks (bool defer_p);
+extern void resume_deferring_access_checks (void);
+extern void stop_deferring_access_checks (void);
+extern void pop_deferring_access_checks (void);
+extern tree get_deferred_access_checks (void);
+extern void pop_to_parent_deferring_access_checks (void);
+extern void perform_deferred_access_checks (void);
+extern void perform_or_defer_access_check (tree, tree);
extern void init_cp_semantics (void);
extern tree finish_expr_stmt (tree);
extern tree begin_if_stmt (void);
extern tree finish_unary_op_expr (enum tree_code, tree);
extern tree finish_compound_literal (tree, tree);
extern tree finish_fname (tree);
-extern void save_type_access_control (tree);
-extern void reset_type_access_control (void);
-extern void decl_type_access_control (tree);
extern int begin_function_definition (tree, tree, tree);
-extern tree begin_constructor_declarator (tree, tree);
extern tree finish_declarator (tree, tree, tree, tree, int);
extern void finish_translation_unit (void);
extern tree finish_template_type_parm (tree, tree);
extern tree finish_member_class_template (tree);
extern void finish_template_decl (tree);
extern tree finish_template_type (tree, tree, int);
-extern void enter_scope_of (tree);
extern tree finish_base_specifier (tree, tree);
extern void finish_member_declaration (tree);
extern void check_multiple_declarators (void);
extern tree build_x_arrow (tree);
extern tree build_m_component_ref (tree, tree);
extern tree build_functional_cast (tree, tree);
-extern void check_for_new_type (const char *, flagged_type_tree);
extern tree add_exception_specifier (tree, tree, int);
extern tree merge_exception_specifiers (tree, tree);