summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-21 23:39:40 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2003-09-21 23:39:40 +0000
commit5e06f14ce2d937fbf061c3a5f8ab44a3c879adc4 (patch)
treed04ef32430711aab636f45451f9e7a3ad34ab36f /gcc/cp
parentb285dcf94d8f07c09b5e17aed045d830a91b7b1c (diff)
downloadgcc-5e06f14ce2d937fbf061c3a5f8ab44a3c879adc4.tar.gz
* tree.h (TREE_LOCUS): Rename from DECL_SOURCE_LOCATION; make const.
(TREE_FILENAME, TREE_LINENO): Likewise. (set_tree_locus, copy_tree_locus, set_tree_file_line): New. (TREE_LOCUS_SET_P): New. * c-aux-info.c, c-decl.c, c-parse.in, coverage.c, dbxout.c, diagnostic.c, dwarf2out.c, dwarfout.c, function.c, integrate.c, print-tree.c, stmt.c, toplev.c, tree-dump.c, tree-inline.c, tree-optimize.c, tree.c, tree.def, xcoffout.c, config/alpha/alpha.c, config/mips/mips.c, doc/c-tree.texi, objc/objc-act.c: Update to match. ada/ * trans.c, utils.c: Update for DECL_SOURCE_LOCATION rename and change to const. cp/ * class.c, cp-tree.h, decl.c, decl2.c, error.c, init.c, method.c, optimize.c, pt.c, semantics.c, tree.c: Update for DECL_SOURCE_LOCATION rename and change to const. f/ * com.c, ste.c: Update for DECL_SOURCE_LOCATION rename and change to const. java/ * class.c, decl.c, jcf-parse.c, jcf-write.c, parse.y, resource.c: Update for DECL_SOURCE_LOCATION rename and change to const. treelang/ * treetree.c: Update for DECL_SOURCE_LOCATION rename and change to const. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71636 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/decl.c21
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/cp/error.c2
-rw-r--r--gcc/cp/init.c2
-rw-r--r--gcc/cp/method.c2
-rw-r--r--gcc/cp/optimize.c4
-rw-r--r--gcc/cp/pt.c32
-rw-r--r--gcc/cp/semantics.c2
-rw-r--r--gcc/cp/tree.c2
12 files changed, 40 insertions, 39 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2734bf6f4d4..19c3c481343 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2003-09-21 Richard Henderson <rth@redhat.com>
+
+ * class.c, cp-tree.h, decl.c, decl2.c, error.c, init.c,
+ method.c, optimize.c, pt.c, semantics.c, tree.c: Update for
+ DECL_SOURCE_LOCATION rename and change to const.
+
2003-09-20 Richard Henderson <rth@redhat.com>
* decl.c, decl2.c, pt.c: Use %J in diagnostics.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 17ff0e49674..ebcad8041a5 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5212,7 +5212,7 @@ finish_struct (tree t, tree attributes)
/* Nadger the current location so that diagnostics point to the start of
the struct, not the end. */
- input_location = DECL_SOURCE_LOCATION (TYPE_NAME (t));
+ input_location = TREE_LOCUS (TYPE_NAME (t));
if (processing_template_decl)
{
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index ef38d5565d8..8f931aa05b1 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -390,7 +390,7 @@ typedef enum cp_id_kind
/* The IDENTIFIER_VALUE is the value of the IDENTIFIER_BINDING, or
NULL_TREE if there is no binding. */
#define IDENTIFIER_VALUE(NODE) \
- (IDENTIFIER_BINDING (NODE) ? IDENTIFIER_BINDING (NODE)->value : NULL)
+ (IDENTIFIER_BINDING (NODE) ? IDENTIFIER_BINDING (NODE)->value : NULL_TREE)
/* If IDENTIFIER_CLASS_VALUE is set, then NODE is bound in the current
class, and IDENTIFIER_CLASS_VALUE is the value binding. This is
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 892affacc82..376d8de10de 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1787,7 +1787,7 @@ print_binding_level (struct cp_binding_level* lvl)
continue;
if (no_print_builtins
&& (TREE_CODE (t) == TYPE_DECL)
- && (!strcmp (DECL_SOURCE_FILE (t),"<built-in>")))
+ && (!strcmp (TREE_FILENAME (t), "<built-in>")))
continue;
/* Function decls tend to have longer names. */
@@ -3153,9 +3153,8 @@ duplicate_decls (tree newdecl, tree olddecl)
if (DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)) == NULL_TREE
&& DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl)) != NULL_TREE)
{
- DECL_SOURCE_LOCATION (olddecl)
- = DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (olddecl))
- = DECL_SOURCE_LOCATION (newdecl);
+ copy_tree_locus (olddecl, newdecl);
+ copy_tree_locus (DECL_TEMPLATE_RESULT (olddecl), newdecl);
}
return 1;
@@ -3195,13 +3194,13 @@ duplicate_decls (tree newdecl, tree olddecl)
TYPE_RAISES_EXCEPTIONS (oldtype));
if ((pedantic || ! DECL_IN_SYSTEM_HEADER (olddecl))
- && DECL_SOURCE_LINE (olddecl) != 0
+ && TREE_LOCUS_SET_P (olddecl)
&& flag_exceptions
&& !comp_except_specs (TYPE_RAISES_EXCEPTIONS (TREE_TYPE (newdecl)),
TYPE_RAISES_EXCEPTIONS (TREE_TYPE (olddecl)), 1))
{
error ("declaration of `%F' throws different exceptions",
- newdecl);
+ newdecl);
cp_error_at ("than previous declaration `%F'", olddecl);
}
}
@@ -3232,7 +3231,7 @@ duplicate_decls (tree newdecl, tree olddecl)
&& DECL_INITIAL (olddecl) != NULL_TREE)
{
DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl);
- DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl);
+ copy_tree_locus (newdecl, olddecl);
if (CAN_HAVE_FULL_LANG_DECL_P (newdecl)
&& DECL_LANG_SPECIFIC (newdecl)
&& DECL_LANG_SPECIFIC (olddecl))
@@ -3701,7 +3700,7 @@ pushdecl (tree x)
if (TREE_CODE (x) == TYPE_DECL)
{
tree type = TREE_TYPE (x);
- if (DECL_SOURCE_LINE (x) == 0)
+ if (!TREE_LOCUS_SET_P (x))
{
if (TYPE_NAME (type) == 0)
TYPE_NAME (type) = x;
@@ -4075,7 +4074,7 @@ pushdecl_class_level (tree x)
for (f = TYPE_FIELDS (TREE_TYPE (x)); f; f = TREE_CHAIN (f))
{
location_t save_location = input_location;
- input_location = DECL_SOURCE_LOCATION (f);
+ input_location = TREE_LOCUS (f);
if (!pushdecl_class_level (f))
is_valid = false;
input_location = save_location;
@@ -4520,7 +4519,7 @@ make_label_decl (tree id, int local_p)
/* Say where one reference is to the label, for the sake of the
error if it is not defined. */
- DECL_SOURCE_LOCATION (decl) = input_location;
+ set_tree_locus (decl, input_location);
/* Record the fact that this identifier is bound to this label. */
SET_IDENTIFIER_LABEL_VALUE (id, decl);
@@ -4831,7 +4830,7 @@ define_label (location_t location, tree name)
/* Mark label as having been defined. */
DECL_INITIAL (decl) = error_mark_node;
/* Say where in the source. */
- DECL_SOURCE_LOCATION (decl) = location;
+ set_tree_locus (decl, location);
if (ent)
{
ent->names_in_scope = current_binding_level->names;
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index b1ee970464e..084cc9b1021 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2240,7 +2240,7 @@ start_static_initialization_or_destruction (tree decl, int initp)
where DECL was declared so that error-messages make sense, and so
that the debugger will show somewhat sensible file and line
information. */
- input_location = DECL_SOURCE_LOCATION (decl);
+ input_location = TREE_LOCUS (decl);
/* Because of:
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index a10dcf6a876..74d1218af1e 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1959,7 +1959,7 @@ location_of (tree t)
else if (TREE_CODE (t) == OVERLOAD)
t = OVL_FUNCTION (t);
- return DECL_SOURCE_LOCATION (t);
+ return TREE_LOCUS (t);
}
/* Now the interfaces from error et al to dump_type et al. Each takes an
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index ace82cdc39f..4427754ea40 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2414,9 +2414,9 @@ create_temporary_var (tree type)
decl = build_decl (VAR_DECL, NULL_TREE, type);
TREE_USED (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
- DECL_SOURCE_LOCATION (decl) = input_location;
DECL_IGNORED_P (decl) = 1;
DECL_CONTEXT (decl) = current_function_decl;
+ set_tree_locus (decl, input_location);
return decl;
}
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 52770042bee..b5d5e327770 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -719,7 +719,7 @@ synthesize_method (tree fndecl)
where the attempt to generate the function occurs, giving the
user a hint as to why we are attempting to generate the
function. */
- DECL_SOURCE_LOCATION (fndecl) = input_location;
+ set_tree_locus (fndecl, input_location);
interface_unknown = 1;
start_function (NULL_TREE, fndecl, NULL_TREE, SF_DEFAULT | SF_PRE_PARSED);
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 2b7df6c5244..a817084bb82 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -109,7 +109,7 @@ update_cloned_parm (tree parm, tree cloned_parm)
/* The name may have changed from the declaration. */
DECL_NAME (cloned_parm) = DECL_NAME (parm);
- DECL_SOURCE_LOCATION (cloned_parm) = DECL_SOURCE_LOCATION (parm);
+ copy_tree_locus (cloned_parm, parm);
}
/* FN is a function that has a complete body. Clone the body as
@@ -146,7 +146,7 @@ maybe_clone_body (tree fn)
splay_tree decl_map;
/* Update CLONE's source position information to match FN's. */
- DECL_SOURCE_LOCATION (clone) = DECL_SOURCE_LOCATION (fn);
+ copy_tree_locus (clone, fn);
DECL_INLINE (clone) = DECL_INLINE (fn);
DECL_DECLARED_INLINE_P (clone) = DECL_DECLARED_INLINE_P (fn);
DECL_COMDAT (clone) = DECL_COMDAT (fn);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 12baea14a33..c1d49e7b056 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -966,10 +966,9 @@ register_specialization (tree spec, tree tmpl, tree args)
else if (DECL_TEMPLATE_SPECIALIZATION (fn))
{
if (!duplicate_decls (spec, fn) && DECL_INITIAL (spec))
- /* Dup decl failed, but this is a new
- definition. Set the line number so any errors
- match this new definition. */
- DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (spec);
+ /* Dup decl failed, but this is a new definition. Set the
+ line number so any errors match this new definition. */
+ copy_tree_locus (fn, spec);
return fn;
}
@@ -1783,9 +1782,8 @@ check_explicit_specialization (tree declarator,
DECL_INITIAL (DECL_TEMPLATE_RESULT (tmpl)) = NULL_TREE;
if (have_def)
{
- DECL_SOURCE_LOCATION (tmpl) = DECL_SOURCE_LOCATION (decl);
- DECL_SOURCE_LOCATION (DECL_TEMPLATE_RESULT (tmpl))
- = DECL_SOURCE_LOCATION (decl);
+ copy_tree_locus (tmpl, decl);
+ copy_tree_locus (DECL_TEMPLATE_RESULT (tmpl), decl);
}
return tmpl;
}
@@ -4255,8 +4253,7 @@ lookup_template_class (tree d1,
type_decl = create_implicit_typedef (DECL_NAME (template), t);
DECL_CONTEXT (type_decl) = TYPE_CONTEXT (t);
TYPE_STUB_DECL (t) = type_decl;
- DECL_SOURCE_LOCATION (type_decl)
- = DECL_SOURCE_LOCATION (TYPE_STUB_DECL (template_type));
+ copy_tree_locus (type_decl, TYPE_STUB_DECL (template_type));
}
else
type_decl = TYPE_NAME (t);
@@ -4712,7 +4709,7 @@ tsubst_friend_function (tree decl, tree args)
tree new_friend;
location_t saved_loc = input_location;
- input_location = DECL_SOURCE_LOCATION (decl);
+ input_location = TREE_LOCUS (decl);
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_TEMPLATE_INSTANTIATION (decl)
@@ -5153,7 +5150,7 @@ instantiate_class_template (tree type)
/* Set the input location to the template definition. This is needed
if tsubsting causes an error. */
- input_location = DECL_SOURCE_LOCATION (TYPE_NAME (pattern));
+ input_location = TREE_LOCUS (TYPE_NAME (pattern));
TYPE_HAS_CONSTRUCTOR (type) = TYPE_HAS_CONSTRUCTOR (pattern);
TYPE_HAS_DESTRUCTOR (type) = TYPE_HAS_DESTRUCTOR (pattern);
@@ -5302,7 +5299,7 @@ instantiate_class_template (tree type)
assist in error message reporting. Since we
called push_tinst_level above, we don't need to
restore these. */
- input_location = DECL_SOURCE_LOCATION (t);
+ input_location = TREE_LOCUS (t);
if (TREE_CODE (t) == TEMPLATE_DECL)
processing_template_decl++;
@@ -5411,7 +5408,7 @@ instantiate_class_template (tree type)
implicit functions at a predictable point, and the same point
that would be used for non-template classes. */
typedecl = TYPE_MAIN_DECL (type);
- input_location = DECL_SOURCE_LOCATION (typedecl);
+ input_location = TREE_LOCUS (typedecl);
unreverse_member_declarations (type);
finish_struct_1 (type);
@@ -5708,7 +5705,7 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain)
/* Set the filename and linenumber to improve error-reporting. */
saved_loc = input_location;
- input_location = DECL_SOURCE_LOCATION (t);
+ input_location = TREE_LOCUS (t);
switch (TREE_CODE (t))
{
@@ -10774,7 +10771,7 @@ instantiate_decl (tree d, int defer_ok)
else
pattern_defined = ! DECL_IN_AGGR_P (code_pattern);
- input_location = DECL_SOURCE_LOCATION (d);
+ input_location = TREE_LOCUS (d);
if (pattern_defined)
{
@@ -10890,7 +10887,7 @@ instantiate_decl (tree d, int defer_ok)
/* We already set the file and line above. Reset them now in case
they changed as a result of calling
regenerate_decl_from_template. */
- input_location = DECL_SOURCE_LOCATION (d);
+ input_location = TREE_LOCUS (d);
if (TREE_CODE (d) == VAR_DECL)
{
@@ -11178,8 +11175,7 @@ tsubst_enum (tree tag, tree newtag, tree args)
}
finish_enum (newtag);
- DECL_SOURCE_LOCATION (TYPE_NAME (newtag))
- = DECL_SOURCE_LOCATION (TYPE_NAME (tag));
+ copy_tree_locus (TYPE_NAME (newtag), TYPE_NAME (tag));
}
/* DECL is a FUNCTION_DECL that is a template specialization. Return
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index ef42579f349..ca04ddf26b6 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2030,7 +2030,7 @@ begin_class_definition (tree t)
}
/* Update the location of the decl. */
- DECL_SOURCE_LOCATION (TYPE_NAME (t)) = input_location;
+ set_tree_locus (TYPE_NAME (t), input_location);
if (TYPE_BEING_DEFINED (t))
{
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 0c729d6118c..6dce605dbd1 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2153,7 +2153,7 @@ cp_copy_res_decl_for_inlining (tree result,
&& DECL_NAME (var) == NULL_TREE)
{
DECL_NAME (var) = DECL_NAME (nrv);
- DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (nrv);
+ copy_tree_locus (var, nrv);
DECL_ABSTRACT_ORIGIN (var) = DECL_ORIGIN (nrv);
/* Don't lose initialization info. */
DECL_INITIAL (var) = DECL_INITIAL (nrv);