diff options
author | Tom Tromey <tromey@redhat.com> | 2007-09-06 16:24:05 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2007-09-06 16:24:05 +0000 |
commit | 5ffeb913b1a455fe79c1c116fc75f09c21194815 (patch) | |
tree | ae71ddc2b3a15a8f7bcf6b36b1592c9fb9c5138e /gcc/tree.c | |
parent | 111f1fca4d2d4e4fabf92b39c4310a3add21f29a (diff) | |
download | gcc-5ffeb913b1a455fe79c1c116fc75f09c21194815.zip gcc-5ffeb913b1a455fe79c1c116fc75f09c21194815.tar.gz gcc-5ffeb913b1a455fe79c1c116fc75f09c21194815.tar.bz2 |
tree-cfg.c (remove_bb): Only warn if line is non-zero.
gcc:
* tree-cfg.c (remove_bb): Only warn if line is non-zero.
* c-pch.c (c_common_read_pch): Restore current location after
reading PCH file.
* tree.c (expand_location): Update.
(expr_filename): Changed return type. Unified the two cases.
(expr_lineno): Likewise.
(annotate_with_file_line): Don't use EXPR_LINENO and EXPR_FILENAME
as lvalues.
* toplev.c (line_table): Changed type.
(general_init): Update.
(realloc_for_line_map): New function.
(general_init): Allocate line_table using GC.
* fix-header.c (line_table): Changed type.
(read_scan_file): Update.
(read_scan_file): Update.
* c-ppoutput.c (maybe_print_line): Update.
(print_line): Update.
(cb_line_change): Update.
(cb_define): Update.
(pp_file_change): Update.
* c-opts.c (c_common_init_options): Update.
(finish_options): Update.
(push_command_line_include): Update.
* c-lex.c (cb_line_change): Update.
(cb_def_pragma): Update.
(cb_define): Update.
(cb_undef): Update.
(c_lex_with_flags): Use cpp_get_token_with_location.
* input.h (line_table): Changed type.
(location_from_locus): New macro.
* tree.h (EXPR_FILENAME): No longer an lvalue.
(EXPR_LINENO): Likewise.
(expr_locus, set_expr_locus): Declare separately for
USE_MAPPED_LOCATION.
(expr_filename, expr_lineno): Changed return type.
* gimplify.c (tree_to_gimple_tuple): Use SET_EXPR_LOCUS.
* cfgexpand.c (expand_gimple_cond_expr): Use location_from_locus.
(expand_gimple_basic_block): Likewise.
* final.c (final_scan_insn): Use expanded_location.
gcc/cp:
* decl.c (finish_function): Put return's location on line zero of
file.
gcc/fortran:
* scanner.c (get_file): Update.
(load_file): Update.
(gfc_next_char_literal): Use gfc_linebuf_linenum.
* f95-lang.c (gfc_init): Update.
* gfortran.h (gfc_linebuf_linenum): New macro.
gcc/java:
* lang.c (java_post_options): Update.
* jcf-parse.c (set_source_filename): Update.
(give_name_to_class): Update.
(jcf_parse): Update.
(duplicate_class_warning): Update.
(parse_class_file): Update.
(java_parse_file): Update.
* expr.c (expand_byte_code): Update.
gcc/testsuite:
* lib/g++.exp (g++_target_compile): Use -fno-show-column.
gcc/treelang:
* tree1.c (treelang_init): Update.
(treelang_parse_file): Update.
(treelang_parse_file): Update.
(treelang_parse_file): Update.
* lex.l: Update.
(update_lineno_charno): Likewise.
libcpp:
* internal.h (struct cpp_reader) <invocation_location>: New
field.
(struct cpp_reader) <set_invocation_location>: Likewise.
* init.c (cpp_set_line_map): New function.
* line-map.c (linemap_add): Use linemap's allocator.
* include/line-map.h (GTY): Define.
(line_map_realloc): New typedef.
(struct line_map): Mark with GTY.
(struct line_maps): Likewise.
(struct line_maps) <maps>: Likewise.
(struct line_maps) <reallocator>: New field.
* include/symtab.h (GTY): Conditionally define.
* include/cpplib.h (cpp_set_line_map): Declare.
(cpp_get_token_with_location): Declare.
* macro.c (cpp_get_token): Set invocation_location on the reader.
(cpp_get_token_with_location): New function.
From-SVN: r128190
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 48 |
1 files changed, 21 insertions, 27 deletions
@@ -3403,7 +3403,7 @@ expand_location (source_location loc) } else { - const struct line_map *map = linemap_lookup (&line_table, loc); + const struct line_map *map = linemap_lookup (line_table, loc); xloc.file = map->to_file; xloc.line = SOURCE_LINE (map, loc); xloc.column = SOURCE_COLUMN (map, loc); @@ -3419,6 +3419,8 @@ expand_location (source_location loc) void annotate_with_file_line (tree node, const char *file, int line) { + location_t *new_loc; + /* Roughly one percent of the calls to this function are to annotate a node with the same information already attached to that node! Just return instead of wasting memory. */ @@ -3443,10 +3445,11 @@ annotate_with_file_line (tree node, const char *file, int line) return; } - SET_EXPR_LOCUS (node, ggc_alloc (sizeof (location_t))); - EXPR_LINENO (node) = line; - EXPR_FILENAME (node) = file; - last_annotated_node = EXPR_LOCUS (node); + new_loc = GGC_NEW (location_t); + new_loc->file = file; + new_loc->line = line; + SET_EXPR_LOCUS (node, new_loc); + last_annotated_node = new_loc; } void @@ -3509,13 +3512,13 @@ expr_locus (const_tree node) { #ifdef USE_MAPPED_LOCATION if (GIMPLE_STMT_P (node)) - return &GIMPLE_STMT_LOCUS (node); - return EXPR_P (node) ? &node->exp.locus : (location_t *) NULL; + return CONST_CAST (source_location *, &GIMPLE_STMT_LOCUS (node)); + return (EXPR_P (node) + ? CONST_CAST (source_location *, &node->exp.locus) + : (source_location *) NULL); #else if (GIMPLE_STMT_P (node)) return GIMPLE_STMT_LOCUS (node); - /* ?? The cast below was originally "(location_t *)" in the macro, - but that makes no sense. ?? */ return EXPR_P (node) ? node->exp.locus : (source_locus) NULL; #endif } @@ -3552,33 +3555,24 @@ set_expr_locus (tree node, #endif } -const char ** +/* Return the file name of the location of NODE. */ +const char * expr_filename (const_tree node) { -#ifdef USE_MAPPED_LOCATION - if (GIMPLE_STMT_P (node)) - return &LOCATION_FILE (GIMPLE_STMT_LOCUS (node)); - return &LOCATION_FILE (EXPR_CHECK (node)->exp.locus); -#else if (GIMPLE_STMT_P (node)) - return &GIMPLE_STMT_LOCUS (node)->file; - return &(EXPR_CHECK (node)->exp.locus->file); -#endif + return LOCATION_FILE (location_from_locus (GIMPLE_STMT_LOCUS (node))); + return LOCATION_FILE (location_from_locus (EXPR_CHECK (node)->exp.locus)); } -int * +/* Return the line number of the location of NODE. */ +int expr_lineno (const_tree node) { -#ifdef USE_MAPPED_LOCATION - if (GIMPLE_STMT_P (node)) - return &LOCATION_LINE (GIMPLE_STMT_LOCUS (node)); - return &LOCATION_LINE (EXPR_CHECK (node)->exp.locus); -#else if (GIMPLE_STMT_P (node)) - return &GIMPLE_STMT_LOCUS (node)->line; - return &EXPR_CHECK (node)->exp.locus->line; -#endif + return LOCATION_LINE (location_from_locus (GIMPLE_STMT_LOCUS (node))); + return LOCATION_LINE (location_from_locus (EXPR_CHECK (node)->exp.locus)); } + /* Return a declaration like DDECL except that its DECL_ATTRIBUTES is ATTRIBUTE. */ |