This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH]: start using location_t
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 03 May 2003 12:37:37 +0100
- Subject: [C++ PATCH]: start using location_t
- Organization: Codesourcery LLC
Hi,
I've installed this obvious patch which adds the obvious changes to the
C++ frontend in using location_t and input_location. These are the
changes that required no interface changes.
booted & tested on i686-pc-linux-gnu
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2003-05-03 Nathan Sidwell <nathan@codesourcery.com>
* class.c (finish_struct): Use location_t and input_location
directly.
* decl.c (make_label_decl): Likewise.
(use_label): Likewise.
* decl2.c (warn_if_unknown_interface): Likewise.
(start_static_initialization_or_destruction): Likewise.
(generate_ctor_or_dtor_function): Likewise.
(finish_file): Likewise.
* error.c (print_instantiation_full_context): Likewise.
* init.c (create_temporary_var): Likewise.
* method.c (synthesize_method): Likewise.
* parser.c (cp_token): Likewise.
(cp_lexer_set_source_position_from_token): Likewise.
(cp_lexer_get_preprocessor_token): Likewise.
(cp_parser_statement): Likewise.
* pt.c (tsubst_friend_function): Likewise.
(instantiate_class_template): Likewise.
(tsubst_decl): Likewise.
(tsubst): Likewise.
(instantiate_decl): Likewise.
* semantics.c (begin_class_definition): Likewise.
(expand_body): Likewise.
Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.536
diff -c -3 -p -r1.536 class.c
*** cp/class.c 1 May 2003 16:13:32 -0000 1.536
--- cp/class.c 2 May 2003 14:59:33 -0000
*************** unreverse_member_declarations (tree t)
*** 5251,5258 ****
tree
finish_struct (tree t, tree attributes)
{
! const char *saved_filename = input_filename;
! int saved_lineno = input_line;
/* Now that we've got all the field declarations, reverse everything
as necessary. */
--- 5251,5257 ----
tree
finish_struct (tree t, tree attributes)
{
! location_t saved_loc = input_location;
/* Now that we've got all the field declarations, reverse everything
as necessary. */
*************** finish_struct (tree t, tree attributes)
*** 5262,5269 ****
/* Nadger the current location so that diagnostics point to the start of
the struct, not the end. */
! input_filename = DECL_SOURCE_FILE (TYPE_NAME (t));
! input_line = DECL_SOURCE_LINE (TYPE_NAME (t));
if (processing_template_decl)
{
--- 5261,5267 ----
/* 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));
if (processing_template_decl)
{
*************** finish_struct (tree t, tree attributes)
*** 5273,5280 ****
else
finish_struct_1 (t);
! input_filename = saved_filename;
! input_line = saved_lineno;
TYPE_BEING_DEFINED (t) = 0;
--- 5271,5277 ----
else
finish_struct_1 (t);
! input_location = saved_loc;
TYPE_BEING_DEFINED (t) = 0;
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1047
diff -c -3 -p -r1.1047 decl.c
*** cp/decl.c 1 May 2003 16:13:32 -0000 1.1047
--- cp/decl.c 2 May 2003 15:00:04 -0000
*************** make_label_decl (tree id, int local_p)
*** 4598,4605 ****
/* Say where one reference is to the label, for the sake of the
error if it is not defined. */
! DECL_SOURCE_LINE (decl) = input_line;
! DECL_SOURCE_FILE (decl) = input_filename;
/* Record the fact that this identifier is bound to this label. */
SET_IDENTIFIER_LABEL_VALUE (id, decl);
--- 4598,4604 ----
/* 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;
/* Record the fact that this identifier is bound to this label. */
SET_IDENTIFIER_LABEL_VALUE (id, decl);
*************** use_label (tree decl)
*** 4625,4632 ****
new_ent->label_decl = decl;
new_ent->names_in_scope = current_binding_level->names;
new_ent->binding_level = current_binding_level;
! new_ent->o_goto_locus.line = input_line;
! new_ent->o_goto_locus.file = input_filename;
new_ent->next = named_label_uses;
named_label_uses = new_ent;
}
--- 4624,4630 ----
new_ent->label_decl = decl;
new_ent->names_in_scope = current_binding_level->names;
new_ent->binding_level = current_binding_level;
! new_ent->o_goto_locus = input_location;
new_ent->next = named_label_uses;
named_label_uses = new_ent;
}
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.625
diff -c -3 -p -r1.625 decl2.c
*** cp/decl2.c 1 May 2003 16:13:33 -0000 1.625
--- cp/decl2.c 2 May 2003 15:00:14 -0000
*************** warn_if_unknown_interface (tree decl)
*** 178,185 ****
if (flag_alt_external_templates)
{
tree til = tinst_for_decl ();
! int sl = input_line;
! const char *sf = input_filename;
if (til)
{
--- 178,184 ----
if (flag_alt_external_templates)
{
tree til = tinst_for_decl ();
! location_t saved_loc = input_location;
if (til)
{
*************** warn_if_unknown_interface (tree decl)
*** 188,195 ****
}
warning ("template `%#D' instantiated in file without #pragma interface",
decl);
! input_line = sl;
! input_filename = sf;
}
else
cp_warning_at ("template `%#D' defined in file without #pragma interface",
--- 187,193 ----
}
warning ("template `%#D' instantiated in file without #pragma interface",
decl);
! input_location = saved_loc;
}
else
cp_warning_at ("template `%#D' defined in file without #pragma interface",
*************** start_static_initialization_or_destructi
*** 2233,2240 ****
where DECL was declared so that error-messages make sense, and so
that the debugger will show somewhat sensible file and line
information. */
! input_filename = DECL_SOURCE_FILE (decl);
! input_line = DECL_SOURCE_LINE (decl);
/* Because of:
--- 2231,2237 ----
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);
/* Because of:
*************** generate_ctor_or_dtor_function (bool con
*** 2474,2481 ****
tree body;
size_t i;
! input_filename = locus->file;
! input_line = locus->line++;
/* We use `I' to indicate initialization and `D' to indicate
destruction. */
--- 2471,2478 ----
tree body;
size_t i;
! input_location = *locus;
! locus->line++;
/* We use `I' to indicate initialization and `D' to indicate
destruction. */
*************** finish_file ()
*** 2554,2561 ****
location_t locus;
unsigned ssdf_count = 0;
! locus.file = input_filename;
! locus.line = input_line;
at_eof = 1;
/* Bad parse errors. Just forget about it. */
--- 2551,2557 ----
location_t locus;
unsigned ssdf_count = 0;
! locus = input_location;
at_eof = 1;
/* Bad parse errors. Just forget about it. */
*************** finish_file ()
*** 2686,2693 ****
/* Set the line and file, so that it is obviously not from
the source file. */
! input_filename = locus.file;
! input_line = locus.line;
ssdf_body = start_static_storage_duration_function (ssdf_count);
/* Make sure the back end knows about all the variables. */
--- 2682,2688 ----
/* Set the line and file, so that it is obviously not from
the source file. */
! input_location = locus;
ssdf_body = start_static_storage_duration_function (ssdf_count);
/* Make sure the back end knows about all the variables. */
*************** finish_file ()
*** 2715,2722 ****
/* Finish up the static storage duration function for this
round. */
! input_filename = locus.file;
! input_line = locus.line;
finish_static_storage_duration_function (ssdf_body);
/* All those initializations and finalizations might cause
--- 2710,2716 ----
/* Finish up the static storage duration function for this
round. */
! input_location = locus;
finish_static_storage_duration_function (ssdf_body);
/* All those initializations and finalizations might cause
*************** finish_file ()
*** 2905,2912 ****
dump_tree_statistics ();
dump_time_statistics ();
}
! input_filename = locus.file;
! input_line = locus.line;
}
/* T is the parse tree for an expression. Return the expression after
--- 2899,2905 ----
dump_tree_statistics ();
dump_time_statistics ();
}
! input_location = locus;
}
/* T is the parse tree for an expression. Return the expression after
Index: cp/error.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/error.c,v
retrieving revision 1.205
diff -c -3 -p -r1.205 error.c
*** cp/error.c 1 May 2003 16:13:33 -0000 1.205
--- cp/error.c 2 May 2003 15:00:19 -0000
*************** static void
*** 2406,2414 ****
print_instantiation_full_context (diagnostic_context *context)
{
tree p = current_instantiation ();
! int line = input_line;
! const char *file = input_filename;
!
if (p)
{
if (current_function_decl != TINST_DECL (p)
--- 2406,2413 ----
print_instantiation_full_context (diagnostic_context *context)
{
tree p = current_instantiation ();
! location_t location = input_location;
!
if (p)
{
if (current_function_decl != TINST_DECL (p)
*************** print_instantiation_full_context (diagno
*** 2423,2439 ****
/* Avoid redundancy with the the "In function" line. */;
else
output_verbatim (&context->buffer,
! "%s: In instantiation of `%s':\n", file,
decl_as_string (TINST_DECL (p),
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
! line = TINST_LINE (p);
! file = TINST_FILE (p);
p = TREE_CHAIN (p);
}
}
! print_instantiation_partial_context (context, p, file, line);
}
/* Same as above but less verbose. */
--- 2422,2439 ----
/* Avoid redundancy with the the "In function" line. */;
else
output_verbatim (&context->buffer,
! "%s: In instantiation of `%s':\n", location.file,
decl_as_string (TINST_DECL (p),
TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE));
! location.line = TINST_LINE (p);
! location.file = TINST_FILE (p);
p = TREE_CHAIN (p);
}
}
! print_instantiation_partial_context (context, p,
! location.file, location.line);
}
/* Same as above but less verbose. */
Index: cp/init.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/init.c,v
retrieving revision 1.318
diff -c -3 -p -r1.318 init.c
*** cp/init.c 1 May 2003 16:13:34 -0000 1.318
--- cp/init.c 2 May 2003 15:00:26 -0000
*************** create_temporary_var (type)
*** 2675,2682 ****
decl = build_decl (VAR_DECL, NULL_TREE, type);
TREE_USED (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
! DECL_SOURCE_FILE (decl) = input_filename;
! DECL_SOURCE_LINE (decl) = input_line;
DECL_IGNORED_P (decl) = 1;
DECL_CONTEXT (decl) = current_function_decl;
--- 2675,2681 ----
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;
Index: cp/method.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/method.c,v
retrieving revision 1.248
diff -c -3 -p -r1.248 method.c
*** cp/method.c 1 May 2003 16:13:34 -0000 1.248
--- cp/method.c 2 May 2003 15:00:28 -0000
*************** synthesize_method (tree fndecl)
*** 754,761 ****
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_LINE (fndecl) = input_line;
! DECL_SOURCE_FILE (fndecl) = input_filename;
interface_unknown = 1;
start_function (NULL_TREE, fndecl, NULL_TREE, SF_DEFAULT | SF_PRE_PARSED);
--- 754,760 ----
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;
interface_unknown = 1;
start_function (NULL_TREE, fndecl, NULL_TREE, SF_DEFAULT | SF_PRE_PARSED);
Index: cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.58
diff -c -3 -p -r1.58 parser.c
*** cp/parser.c 1 May 2003 16:13:34 -0000 1.58
--- cp/parser.c 2 May 2003 15:00:59 -0000
*************** typedef struct cp_token GTY (())
*** 74,83 ****
/* If this token is a keyword, this value indicates which keyword.
Otherwise, this value is RID_MAX. */
enum rid keyword;
! /* The file in which this token was found. */
! const char *file_name;
! /* The line at which this token was found. */
! int line_number;
} cp_token;
/* The number of tokens in a single token block. */
--- 74,81 ----
/* If this token is a keyword, this value indicates which keyword.
Otherwise, this value is RID_MAX. */
enum rid keyword;
! /* The location at which this token was found. */
! location_t location;
} cp_token;
/* The number of tokens in a single token block. */
*************** cp_lexer_set_source_position_from_token
*** 406,415 ****
/* Update the line number. */
if (token->type != CPP_EOF)
! {
! input_line = token->line_number;
! input_filename = token->file_name;
! }
}
/* TOKEN points into the circular token buffer. Return a pointer to
--- 404,410 ----
/* Update the line number. */
if (token->type != CPP_EOF)
! input_location = token->location;
}
/* TOKEN points into the circular token buffer. Return a pointer to
*************** cp_lexer_get_preprocessor_token (cp_lexe
*** 621,628 ****
if (lexer != NULL && !lexer->main_lexer_p)
{
token->type = CPP_EOF;
! token->line_number = 0;
! token->file_name = NULL;
token->value = NULL_TREE;
token->keyword = RID_MAX;
--- 616,623 ----
if (lexer != NULL && !lexer->main_lexer_p)
{
token->type = CPP_EOF;
! token->location.line = 0;
! token->location.file = NULL;
token->value = NULL_TREE;
token->keyword = RID_MAX;
*************** cp_lexer_get_preprocessor_token (cp_lexe
*** 651,658 ****
}
}
/* Now we've got our token. */
! token->line_number = input_line;
! token->file_name = input_filename;
/* Check to see if this token is a keyword. */
if (token->type == CPP_NAME
--- 646,652 ----
}
}
/* Now we've got our token. */
! token->location = input_location;
/* Check to see if this token is a keyword. */
if (token->type == CPP_NAME
*************** cp_parser_statement (cp_parser* parser)
*** 5591,5597 ****
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
/* Remember the line number of the first token in the statement. */
! statement_line_number = token->line_number;
/* If this is a keyword, then that will often determine what kind of
statement we have. */
if (token->type == CPP_KEYWORD)
--- 5585,5591 ----
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
/* Remember the line number of the first token in the statement. */
! statement_line_number = token->location.line;
/* If this is a keyword, then that will often determine what kind of
statement we have. */
if (token->type == CPP_KEYWORD)
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.687
diff -c -3 -p -r1.687 pt.c
*** cp/pt.c 1 May 2003 16:13:34 -0000 1.687
--- cp/pt.c 2 May 2003 15:01:23 -0000
*************** tsubst_friend_function (decl, args)
*** 4861,4871 ****
tree args;
{
tree new_friend;
! int line = input_line;
! const char *file = input_filename;
! input_line = DECL_SOURCE_LINE (decl);
! input_filename = DECL_SOURCE_FILE (decl);
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_TEMPLATE_INSTANTIATION (decl)
--- 4861,4869 ----
tree args;
{
tree new_friend;
! location_t saved_loc = input_location;
! input_location = DECL_SOURCE_LOCATION (decl);
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_TEMPLATE_INSTANTIATION (decl)
*************** tsubst_friend_function (decl, args)
*** 5072,5079 ****
}
done:
! input_line = line;
! input_filename = file;
return new_friend;
}
--- 5070,5076 ----
}
done:
! input_location = saved_loc;
return new_friend;
}
*************** instantiate_class_template (type)
*** 5436,5443 ****
assist in error message reporting. Since we
called push_tinst_level above, we don't need to
restore these. */
! input_line = DECL_SOURCE_LINE (t);
! input_filename = DECL_SOURCE_FILE (t);
r = tsubst (t, args, tf_error | tf_warning, NULL_TREE);
if (TREE_CODE (r) == VAR_DECL)
--- 5433,5439 ----
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);
r = tsubst (t, args, tf_error | tf_warning, NULL_TREE);
if (TREE_CODE (r) == VAR_DECL)
*************** instantiate_class_template (type)
*** 5539,5547 ****
implicit functions at a predictable point, and the same point
that would be used for non-template classes. */
typedecl = TYPE_MAIN_DECL (type);
! input_line = DECL_SOURCE_LINE (typedecl);
! input_filename = DECL_SOURCE_FILE (typedecl);
!
unreverse_member_declarations (type);
finish_struct_1 (type);
CLASSTYPE_GOT_SEMICOLON (type) = 1;
--- 5535,5542 ----
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);
!
unreverse_member_declarations (type);
finish_struct_1 (type);
CLASSTYPE_GOT_SEMICOLON (type) = 1;
*************** tsubst_decl (t, args, type, complain)
*** 5878,5893 ****
tree type;
tsubst_flags_t complain;
{
! int saved_lineno;
! const char *saved_filename;
tree r = NULL_TREE;
tree in_decl = t;
/* Set the filename and linenumber to improve error-reporting. */
! saved_lineno = input_line;
! saved_filename = input_filename;
! input_line = DECL_SOURCE_LINE (t);
! input_filename = DECL_SOURCE_FILE (t);
switch (TREE_CODE (t))
{
--- 5873,5885 ----
tree type;
tsubst_flags_t complain;
{
! location_t saved_loc;
tree r = NULL_TREE;
tree in_decl = t;
/* Set the filename and linenumber to improve error-reporting. */
! saved_loc = input_location;
! input_location = DECL_SOURCE_LOCATION (t);
switch (TREE_CODE (t))
{
*************** tsubst_decl (t, args, type, complain)
*** 6353,6360 ****
}
/* Restore the file and line information. */
! input_line = saved_lineno;
! input_filename = saved_filename;
return r;
}
--- 6345,6351 ----
}
/* Restore the file and line information. */
! input_location = saved_loc;
return r;
}
*************** tsubst (t, args, complain, in_decl)
*** 6869,6882 ****
if (TREE_CODE (type) == REFERENCE_TYPE
|| (code == REFERENCE_TYPE && TREE_CODE (type) == VOID_TYPE))
{
! static int last_line = 0;
! static const char* last_file = 0;
/* We keep track of the last time we issued this error
message to avoid spewing a ton of messages during a
single bad template instantiation. */
if (complain & tf_error
! && (last_line != input_line || last_file != input_filename))
{
if (TREE_CODE (type) == VOID_TYPE)
error ("forming reference to void");
--- 6860,6873 ----
if (TREE_CODE (type) == REFERENCE_TYPE
|| (code == REFERENCE_TYPE && TREE_CODE (type) == VOID_TYPE))
{
! static location_t last_loc;
/* We keep track of the last time we issued this error
message to avoid spewing a ton of messages during a
single bad template instantiation. */
if (complain & tf_error
! && (last_loc.line != input_line
! || last_loc.file != input_filename))
{
if (TREE_CODE (type) == VOID_TYPE)
error ("forming reference to void");
*************** tsubst (t, args, complain, in_decl)
*** 6884,6891 ****
error ("forming %s to reference type `%T'",
(code == POINTER_TYPE) ? "pointer" : "reference",
type);
! last_line = input_line;
! last_file = input_filename;
}
return error_mark_node;
--- 6875,6881 ----
error ("forming %s to reference type `%T'",
(code == POINTER_TYPE) ? "pointer" : "reference",
type);
! last_loc = input_location;
}
return error_mark_node;
*************** instantiate_decl (d, defer_ok)
*** 10759,10768 ****
tree spec;
tree gen_tmpl;
int pattern_defined;
- int line = input_line;
int need_push;
! const char *file = input_filename;
!
/* This function should only be used to instantiate templates for
functions and static member variables. */
my_friendly_assert (TREE_CODE (d) == FUNCTION_DECL
--- 10749,10757 ----
tree spec;
tree gen_tmpl;
int pattern_defined;
int need_push;
! location_t saved_loc = input_location;
!
/* This function should only be used to instantiate templates for
functions and static member variables. */
my_friendly_assert (TREE_CODE (d) == FUNCTION_DECL
*************** instantiate_decl (d, defer_ok)
*** 10825,10832 ****
else
pattern_defined = ! DECL_IN_AGGR_P (code_pattern);
! input_line = DECL_SOURCE_LINE (d);
! input_filename = DECL_SOURCE_FILE (d);
if (pattern_defined)
{
--- 10814,10820 ----
else
pattern_defined = ! DECL_IN_AGGR_P (code_pattern);
! input_location = DECL_SOURCE_LOCATION (d);
if (pattern_defined)
{
*************** instantiate_decl (d, defer_ok)
*** 10913,10920 ****
because it's used by add_pending_template. */
else if (! pattern_defined || defer_ok)
{
! input_line = line;
! input_filename = file;
if (at_eof && !pattern_defined
&& DECL_EXPLICIT_INSTANTIATION (d))
--- 10901,10907 ----
because it's used by add_pending_template. */
else if (! pattern_defined || defer_ok)
{
! input_location = saved_loc;
if (at_eof && !pattern_defined
&& DECL_EXPLICIT_INSTANTIATION (d))
*************** instantiate_decl (d, defer_ok)
*** 10941,10949 ****
regenerate_decl_from_template (d, td);
/* 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_line = DECL_SOURCE_LINE (d);
! input_filename = DECL_SOURCE_FILE (d);
if (TREE_CODE (d) == VAR_DECL)
{
--- 10928,10936 ----
regenerate_decl_from_template (d, td);
/* 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);
if (TREE_CODE (d) == VAR_DECL)
{
*************** instantiate_decl (d, defer_ok)
*** 11048,11056 ****
pop_from_top_level ();
out:
! input_line = line;
! input_filename = file;
!
pop_tinst_level ();
timevar_pop (TV_PARSE);
--- 11035,11041 ----
pop_from_top_level ();
out:
! input_location = saved_loc;
pop_tinst_level ();
timevar_pop (TV_PARSE);
Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.302
diff -c -3 -p -r1.302 semantics.c
*** cp/semantics.c 1 May 2003 16:13:34 -0000 1.302
--- cp/semantics.c 2 May 2003 15:01:28 -0000
*************** begin_class_definition (t)
*** 1804,1811 ****
}
/* Update the location of the decl. */
! DECL_SOURCE_FILE (TYPE_NAME (t)) = input_filename;
! DECL_SOURCE_LINE (TYPE_NAME (t)) = input_line;
if (TYPE_BEING_DEFINED (t))
{
--- 1804,1810 ----
}
/* Update the location of the decl. */
! DECL_SOURCE_LOCATION (TYPE_NAME (t)) = input_location;
if (TYPE_BEING_DEFINED (t))
{
*************** void
*** 2303,2310 ****
expand_body (fn)
tree fn;
{
! int saved_lineno;
! const char *saved_input_filename;
tree saved_function;
/* When the parser calls us after finishing the body of a template
--- 2302,2308 ----
expand_body (fn)
tree fn;
{
! location_t saved_loc;
tree saved_function;
/* When the parser calls us after finishing the body of a template
*************** expand_body (fn)
*** 2384,2396 ****
return;
/* Save the current file name and line number. When we expand the
! body of the function, we'll set LINENO and INPUT_FILENAME so that
error-mesages come out in the right places. */
! saved_lineno = input_line;
! saved_input_filename = input_filename;
saved_function = current_function_decl;
! input_line = DECL_SOURCE_LINE (fn);
! input_filename = DECL_SOURCE_FILE (fn);
current_function_decl = fn;
timevar_push (TV_INTEGRATION);
--- 2382,2392 ----
return;
/* Save the current file name and line number. When we expand the
! body of the function, we'll set INPUT_LOCATION so that
error-mesages come out in the right places. */
! saved_loc = input_location;
saved_function = current_function_decl;
! input_location = DECL_SOURCE_LOCATION (fn);
current_function_decl = fn;
timevar_push (TV_INTEGRATION);
*************** expand_body (fn)
*** 2433,2440 ****
/* And restore the current source position. */
current_function_decl = saved_function;
! input_line = saved_lineno;
! input_filename = saved_input_filename;
extract_interface_info ();
timevar_pop (TV_EXPAND);
--- 2429,2435 ----
/* And restore the current source position. */
current_function_decl = saved_function;
! input_location = saved_loc;
extract_interface_info ();
timevar_pop (TV_EXPAND);