cp-tree.def (TINST_LEVEL): Make it an 'x' node.
* cp-tree.def (TINST_LEVEL): Make it an 'x' node. * cp-tree.h (tinst_level_t): New tree type. (union lang_tree_node): Handle it. (TINST_LOCATION): New accessor macro. (make_tinst_level): New prototype. * cp-lang.c (cp_tree_size): Handle TINST_LEVEL. * decl.c (cp_tree_node_structure): Likewise. * error.c (print_instantiation_full_context): Use TINST_LOCATION. (print_instantiation_partial_context): Likewise. * pt.c (pop_tinst_level): Likewise. (push_tinst_level): Use make_tinst_level. * tree.c (make_tinst_level): New function. (cp_walk_subtrees): Walk TINST_DECL for a TINST_LEVEL node. From-SVN: r84977
This commit is contained in:
parent
3e95a7cbf5
commit
406d77a4bb
@ -1,3 +1,19 @@
|
||||
2004-07-20 Steven Bosscher <stevenb@suse.de>
|
||||
|
||||
* cp-tree.def (TINST_LEVEL): Make it an 'x' node.
|
||||
* cp-tree.h (tinst_level_t): New tree type.
|
||||
(union lang_tree_node): Handle it.
|
||||
(TINST_LOCATION): New accessor macro.
|
||||
(make_tinst_level): New prototype.
|
||||
* cp-lang.c (cp_tree_size): Handle TINST_LEVEL.
|
||||
* decl.c (cp_tree_node_structure): Likewise.
|
||||
* error.c (print_instantiation_full_context): Use TINST_LOCATION.
|
||||
(print_instantiation_partial_context): Likewise.
|
||||
* pt.c (pop_tinst_level): Likewise.
|
||||
(push_tinst_level): Use make_tinst_level.
|
||||
* tree.c (make_tinst_level): New function.
|
||||
(cp_walk_subtrees): Walk TINST_DECL for a TINST_LEVEL node.
|
||||
|
||||
2004-07-20 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* parser.c (cp_parser_simple_type_specifier): Fix typo.
|
||||
|
@ -284,6 +284,7 @@ cp_tree_size (enum tree_code code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case TINST_LEVEL: return sizeof (struct tinst_level_s);
|
||||
case PTRMEM_CST: return sizeof (struct ptrmem_cst);
|
||||
case BASELINK: return sizeof (struct tree_baselink);
|
||||
case TEMPLATE_PARM_INDEX: return sizeof (template_parm_index);
|
||||
|
@ -274,12 +274,13 @@ DEFTREECODE (TAG_DEFN, "tag_defn", 'e', 0)
|
||||
|
||||
/* Template instantiation level node.
|
||||
|
||||
Operand 1 contains the original DECL node and can be accessed via TINST_DECL.
|
||||
TINST_DECL contains the original DECL node.
|
||||
TINST_LOCATION contains the location where the template is instantiated.
|
||||
|
||||
A stack of template instantiation nodes is kept through the TREE_CHAIN
|
||||
fields of these nodes. */
|
||||
|
||||
DEFTREECODE (TINST_LEVEL, "TINST_LEVEL", 'e', 1)
|
||||
DEFTREECODE (TINST_LEVEL, "TINST_LEVEL", 'x', 0)
|
||||
|
||||
/*
|
||||
Local variables:
|
||||
|
@ -183,14 +183,23 @@ struct lang_identifier GTY(())
|
||||
#define LANG_IDENTIFIER_CAST(NODE) \
|
||||
((struct lang_identifier*)IDENTIFIER_NODE_CHECK (NODE))
|
||||
|
||||
typedef struct template_parm_index_s GTY(())
|
||||
struct template_parm_index_s GTY(())
|
||||
{
|
||||
struct tree_common common;
|
||||
HOST_WIDE_INT index;
|
||||
HOST_WIDE_INT level;
|
||||
HOST_WIDE_INT orig_level;
|
||||
tree decl;
|
||||
} template_parm_index;
|
||||
};
|
||||
typedef struct template_parm_index_s template_parm_index;
|
||||
|
||||
struct tinst_level_s GTY(())
|
||||
{
|
||||
struct tree_common common;
|
||||
tree decl;
|
||||
location_t locus;
|
||||
};
|
||||
typedef struct tinst_level_s * tinst_level_t;
|
||||
|
||||
struct ptrmem_cst GTY(())
|
||||
{
|
||||
@ -385,6 +394,7 @@ enum cp_tree_node_structure_enum {
|
||||
TS_CP_GENERIC,
|
||||
TS_CP_IDENTIFIER,
|
||||
TS_CP_TPI,
|
||||
TS_CP_TINST_LEVEL,
|
||||
TS_CP_PTRMEM,
|
||||
TS_CP_BINDING,
|
||||
TS_CP_OVERLOAD,
|
||||
@ -401,6 +411,7 @@ union lang_tree_node GTY((desc ("cp_tree_node_structure (&%h)"),
|
||||
union tree_node GTY ((tag ("TS_CP_GENERIC"),
|
||||
desc ("tree_node_structure (&%h)"))) generic;
|
||||
struct template_parm_index_s GTY ((tag ("TS_CP_TPI"))) tpi;
|
||||
struct tinst_level_s GTY ((tag ("TS_CP_TINST_LEVEL"))) tinst_level;
|
||||
struct ptrmem_cst GTY ((tag ("TS_CP_PTRMEM"))) ptrmem;
|
||||
struct tree_overload GTY ((tag ("TS_CP_OVERLOAD"))) overload;
|
||||
struct tree_baselink GTY ((tag ("TS_CP_BASELINK"))) baselink;
|
||||
@ -3008,7 +3019,10 @@ typedef enum unification_kind_t {
|
||||
|
||||
/* Macros for operating on a template instantiation level node. */
|
||||
|
||||
#define TINST_DECL(NODE) TREE_OPERAND (NODE, 0)
|
||||
#define TINST_DECL(NODE) \
|
||||
(((tinst_level_t) TINST_LEVEL_CHECK (NODE))->decl)
|
||||
#define TINST_LOCATION(NODE) \
|
||||
(((tinst_level_t) TINST_LEVEL_CHECK (NODE))->locus)
|
||||
|
||||
/* in class.c */
|
||||
|
||||
@ -4168,6 +4182,7 @@ extern tree build_dummy_object (tree);
|
||||
extern tree maybe_dummy_object (tree, tree *);
|
||||
extern int is_dummy_object (tree);
|
||||
extern const struct attribute_spec cxx_attribute_table[];
|
||||
extern tree make_tinst_level (tree, location_t);
|
||||
extern tree make_ptrmem_cst (tree, tree);
|
||||
extern tree cp_build_type_attribute_variant (tree, tree);
|
||||
extern tree cp_build_qualified_type_real (tree, int, tsubst_flags_t);
|
||||
|
@ -10711,6 +10711,7 @@ cp_tree_node_structure (union lang_tree_node * t)
|
||||
case IDENTIFIER_NODE: return TS_CP_IDENTIFIER;
|
||||
case OVERLOAD: return TS_CP_OVERLOAD;
|
||||
case TEMPLATE_PARM_INDEX: return TS_CP_TPI;
|
||||
case TINST_LEVEL: return TS_CP_TINST_LEVEL;
|
||||
case PTRMEM_CST: return TS_CP_PTRMEM;
|
||||
case BASELINK: return TS_CP_BASELINK;
|
||||
default: return TS_CP_GENERIC;
|
||||
|
@ -2209,7 +2209,7 @@ print_instantiation_full_context (diagnostic_context *context)
|
||||
decl_as_string (TINST_DECL (p),
|
||||
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
|
||||
|
||||
location = EXPR_LOCATION (p);
|
||||
location = TINST_LOCATION (p);
|
||||
p = TREE_CHAIN (p);
|
||||
}
|
||||
}
|
||||
@ -2232,7 +2232,7 @@ print_instantiation_partial_context (diagnostic_context *context,
|
||||
xloc.file, xloc.line,
|
||||
decl_as_string (TINST_DECL (t),
|
||||
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
|
||||
loc = EXPR_LOCATION (t);
|
||||
loc = TINST_LOCATION (t);
|
||||
}
|
||||
pp_verbatim (context->printer, "%s:%d: instantiated from here\n",
|
||||
xloc.file, xloc.line);
|
||||
|
@ -4873,9 +4873,7 @@ push_tinst_level (tree d)
|
||||
return 0;
|
||||
}
|
||||
|
||||
new = make_node (TINST_LEVEL);
|
||||
SET_EXPR_LOCATION (new, input_location);
|
||||
TINST_DECL (new) = d;
|
||||
new = make_tinst_level (d, input_location);
|
||||
TREE_CHAIN (new) = current_tinst_level;
|
||||
current_tinst_level = new;
|
||||
|
||||
@ -4899,7 +4897,7 @@ pop_tinst_level (void)
|
||||
|
||||
/* Restore the filename and line number stashed away when we started
|
||||
this instantiation. */
|
||||
input_location = EXPR_LOCATION (old);
|
||||
input_location = TINST_LOCATION (old);
|
||||
extract_interface_info ();
|
||||
|
||||
current_tinst_level = TREE_CHAIN (old);
|
||||
|
@ -1900,6 +1900,17 @@ handle_init_priority_attribute (tree* node,
|
||||
}
|
||||
}
|
||||
|
||||
/* Return a new TINST_LEVEL for DECL at location locus. */
|
||||
tree
|
||||
make_tinst_level (tree decl, location_t locus)
|
||||
{
|
||||
tree tinst_level = make_node (TINST_LEVEL);
|
||||
TREE_CHAIN (tinst_level) = NULL_TREE;
|
||||
TINST_DECL (tinst_level) = decl;
|
||||
TINST_LOCATION (tinst_level) = locus;
|
||||
return tinst_level;
|
||||
}
|
||||
|
||||
/* Return a new PTRMEM_CST of the indicated TYPE. The MEMBER is the
|
||||
thing pointed to by the constant. */
|
||||
|
||||
@ -1973,6 +1984,11 @@ cp_walk_subtrees (tree *tp, int *walk_subtrees_p, walk_tree_fn func,
|
||||
*walk_subtrees_p = 0;
|
||||
break;
|
||||
|
||||
case TINST_LEVEL:
|
||||
WALK_SUBTREE (TINST_DECL (*tp));
|
||||
*walk_subtrees_p = 0;
|
||||
break;
|
||||
|
||||
case PTRMEM_CST:
|
||||
WALK_SUBTREE (TREE_TYPE (*tp));
|
||||
*walk_subtrees_p = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user