diff options
author | Per Bothner <per@bothner.com> | 2004-06-30 10:58:21 -0700 |
---|---|---|
committer | Per Bothner <bothner@gcc.gnu.org> | 2004-06-30 10:58:21 -0700 |
commit | c166747038bc41ee6702618828e5c915cc4e47ea (patch) | |
tree | bf7c0b00dcfa76e28cdeb61f5339d2924ef9dc16 /gcc/tree.c | |
parent | b5674962f18be68ae4b22042b09fd251ccd09ed1 (diff) | |
download | gcc-c166747038bc41ee6702618828e5c915cc4e47ea.zip gcc-c166747038bc41ee6702618828e5c915cc4e47ea.tar.gz gcc-c166747038bc41ee6702618828e5c915cc4e47ea.tar.bz2 |
Conditionally compile support for --enable-mapped_location.
* input.h: #include line-map.h for source_location typedef.
(BUILTINS_LOCATION, UNKNOWN_LOCATION, expand_location,
LOCATION_FILE, LOCATION_LINE): New macros and functions.
(expanded_location, source_locus): New typedefs.
(push_srcloc): Change parameter list if USE_MAPPED_LOCATION.
* rtl.def (NOTE, ASM_OPERANDS): Modify specifcation, if
USE_MAPPED_LOCATION.
* rtl.h (NOTE_DELETED_LABEL_NAME): New macro.
(NOTE_SOURCE_LOCATION, NOTE_EXPNDED_LOCATION, SET_INSN_DELETED):
New conditional macros.
(ASM_OPERANDS_SOURCE_FILE, ASM_OPERANDS_SOURCE_LINE): Replace
by ASM_OPERANDS_SOURCE_LOCATION if USE_MAPPED_LOCATION.
* tree.h (EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_HAS_LOCATION,
EXPR_LOCUS, SET_EXPR_LOCUS, EXPR_FILENAME, EXPR_LINENO,
DECL_IS_BUILTIN): New macros, most depending on USE_MAPPED__LOCATION.
(tree_exp): Change type of locus to use new source_locus typedef.
* tree.c (build1_stat): Use SET_EXPR_LOCATION.
(annotate_with_locus, annotate_with_file_line): Conditionalize.
(expand_location): New function.
* toplev.c (unknown_location): New static, when USE_MAPPED_LOCATION.
(push_srcloc, pop_loc): Adjust parameter handling.
(process_options): Don't set input_filename by itself.
(lang_dependent_init): Save, set input_location to <built-in>.
(warn_deprecated_use): Use expand_location.
From-SVN: r83918
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -2438,7 +2438,11 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL) TREE_SET_CODE (t, code); TREE_TYPE (t) = type; +#ifdef USE_MAPPED_LOCATION + SET_EXPR_LOCATION (t, UNKNOWN_LOCATION); +#else SET_EXPR_LOCUS (t, NULL); +#endif TREE_COMPLEXITY (t) = 0; TREE_OPERAND (t, 0) = node; TREE_BLOCK (t) = NULL_TREE; @@ -2748,7 +2752,28 @@ build_block (tree vars, tree tags ATTRIBUTE_UNUSED, tree subblocks, return block; } +#if 1 /* ! defined(USE_MAPPED_LOCATION) */ +/* ??? gengtype doesn't handle conditionals */ static GTY(()) tree last_annotated_node; +#endif + +#ifdef USE_MAPPED_LOCATION + +expanded_location +expand_location (source_location loc) +{ + expanded_location xloc; + if (loc == 0) { xloc.file = NULL; xloc.line = 0; } + else + { + const struct line_map *map = linemap_lookup (&line_table, loc); + xloc.file = map->to_file; + xloc.line = SOURCE_LINE (map, loc); + }; + return xloc; +} + +#else /* Record the exact location where an expression or an identifier were encountered. */ @@ -2792,6 +2817,7 @@ annotate_with_locus (tree node, location_t locus) { annotate_with_file_line (node, locus.file, locus.line); } +#endif /* Return a declaration like DDECL except that its DECL_ATTRIBUTES is ATTRIBUTE. */ |