aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2012-09-19 19:56:42 +0000
committerDehao Chen <dehao@gcc.gnu.org>2012-09-19 19:56:42 +0000
commit5368224f426c0dbe08a42e89d4cd18b0c8435834 (patch)
treecb527556784345ff0f9931444fd4e51652a67835 /libcpp
parent1a83e602a157b844ed98d0dab832c1240ed6bf4b (diff)
downloadgcc-5368224f426c0dbe08a42e89d4cd18b0c8435834.zip
gcc-5368224f426c0dbe08a42e89d4cd18b0c8435834.tar.gz
gcc-5368224f426c0dbe08a42e89d4cd18b0c8435834.tar.bz2
Integrate lexical block into source_location.
gcc: 2012-09-19 Dehao Chen <dehao@google.com> * toplev.c (general_init): Init block_locations. * tree.c (tree_set_block): New. (tree_block): Change to use LOCATION_BLOCK. * tree.h (TREE_SET_BLOCK): New. * final.c (reemit_insn_block_notes): Change to use LOCATION_BLOCK. (final_start_function): Likewise. * input.c (expand_location_1): Likewise. * input.h (LOCATION_LOCUS): New. (LOCATION_BLOCK): New. (IS_UNKNOWN_LOCATION): New. * fold-const.c (expr_location_or): Change to use new location. * reorg.c (emit_delay_sequence): Likewise. (try_merge_delay_insns): Likewise. * modulo-sched.c (dump_insn_location): Likewise. * lto-streamer-out.c (lto_output_location_bitpack): Likewise. * lto-cgraph.c (output_node_opt_summary): Likewise. * jump.c (rtx_renumbered_equal_p): Likewise. * ifcvt.c (noce_try_move): Likewise. (noce_try_store_flag): Likewise. (noce_try_store_flag_constants): Likewise. (noce_try_addcc): Likewise. (noce_try_store_flag_mask): Likewise. (noce_try_cmove): Likewise. (noce_try_cmove_arith): Likewise. (noce_try_minmax): Likewise. (noce_try_abs): Likewise. (noce_try_sign_mask): Likewise. (noce_try_bitop): Likewise. (noce_process_if_block): Likewise. (cond_move_process_if_block): Likewise. (find_cond_trap): Likewise. * ipa-prop.c (ipa_set_jf_constant): Likewise. (ipa_write_jump_function): Likewise. * dwarf2out.c (add_src_coords_attributes): Likewise. * expr.c (expand_expr_real): Likewise. * tree-parloops.c (create_loop_fn): Likewise. * recog.c (peep2_attempt): Likewise. * function.c (free_after_compilation): Likewise. (expand_function_end): Likewise. (set_insn_locations): Likewise. (thread_prologue_and_epilogue_insns): Likewise. * print-rtl.c (print_rtx): Likewise. * profile.c (branch_prob): Likewise. * trans-mem.c (ipa_tm_scan_irr_block): Likewise. * gimplify.c (gimplify_call_expr): Likewise. * except.c (duplicate_eh_regions_1): Likewise. * emit-rtl.c (try_split): Likewise. (make_insn_raw): Likewise. (make_debug_insn_raw): Likewise. (make_jump_insn_raw): Likewise. (make_call_insn_raw): Likewise. (emit_pattern_after_setloc): Likewise. (emit_pattern_after): Likewise. (emit_debug_insn_after): Likewise. (emit_pattern_before): Likewise. (emit_insn_before_setloc): Likewise. (emit_jump_insn_before): Likewise. (emit_call_insn_before_setloc): Likewise. (emit_call_insn_before): Likeise. (emit_debug_insn_before_setloc): Likewise. (emit_copy_of_insn_after): Likewise. (insn_locators_alloc): Remove. (insn_locators_finalize): Remove. (insn_locators_free): Remove. (set_curr_insn_source_location): Remove. (get_curr_insn_source_location): Remove. (set_curr_insn_block): Remove. (get_curr_insn_block): Remove. (locator_scope): Remove. (insn_scope): Change to use new location. (locator_location): Remove. (insn_line): Change to use new location. (locator_file): Remove. (insn_file): Change to use new location. (locator_eq): Remove. (insn_locations_init): New. (insn_locations_finalize): New. (set_curr_insn_location): New. (curr_insn_location): New. * cfgexpand.c (gimple_assign_rhs_to_tree): Change to use new location. (expand_gimple_cond): Likewise. (expand_call_stmt): Likewise. (expand_gimple_stmt_1): Likewise. (expand_gimple_basic_block): Likewise. (construct_exit_block): Likewise. (gimple_expand_cfg): Likewise. * cfgcleanup.c (try_forward_edges): Likewise. * tree-ssa-live.c (remove_unused_scope_block_p): Likewise. (dump_scope_block): Likewise. (remove_unused_locals): Likewise. * rtl.c (rtx_equal_p_cb): Likewise. (rtx_equal_p): Likewise. * rtl.h (XUINT): New. (INSN_LOCATOR): Remove. (CURR_INSN_LOCATION): Remove. (INSN_LOCATION): New. (INSN_HAS_LOCATION): New. * tree-inline.c (remap_gimple_op_r): Change to use new location. (copy_tree_body_r): Likewise. (copy_phis_for_bb): Likewise. (expand_call_inline): Likewise. * tree-streamer-in.c (lto_input_ts_exp_tree_pointers): Likewise. * tree-streamer-out.c (write_ts_decl_minimal_tree_pointers): Likewise. * gimple-streamer-out.c (output_gimple_stmt): Likewise. * combine.c (try_combine): Likewise. * tree-outof-ssa.c (set_location_for_edge): Likewise. (insert_partition_copy_on_edge): Likewise. (insert_value_copy_on_edge): Likewise. (insert_rtx_to_part_on_edge): Likewise. (insert_part_to_rtx_on_edge): Likewise. * basic-block.h (edge_def): Remove field. * gimple.h (gimple_statement_base): Remove field. (gimple_bb): Change to use new location. (gimple_set_block): Likewise. (gimple_has_location): Likewise. * tree-cfg.c (make_cond_expr_edges): Likewise. (make_goto_expr_edges): Likewise. (gimple_can_merge_blocks_p): Likewise. (move_stmt_op): Likewise. (move_block_to_fn): Likewise. * config/alpha/alpha.c (alpha_output_mi_thunk_osf): Likewise. * config/sparc/sparc.c (sparc_output_mi_thunk): Likewise. * config/i386/i386.c (x86_output_mi_thunk): Likewise. * config/tilegx/tilegx.c (tilegx_output_mi_thunk): Likewise. * config/sh/sh.c (sh_output_mi_thunk): Likewise. * config/ia64/ia64.c (ia64_output_mi_thunk): Likewise. * config/rs6000/rs6000.c (rs6000_output_mi_thunk): Likewise. * config/score/score.c (score_output_mi_thunk): Likewise. * config/tilepro/tilepro.c (tilepro_asm_output_mi_thunk): Likewise. * config/mips/mips.c (mips_output_mi_thunk): Likewise. * cfgrtl.c (unique_locus_on_edge_between_p): Likewise. (unique_locus_on_edge_between_p): Likewise. (emit_nop_for_unique_locus_between): Likewise. (force_nonfallthru_and_redirect): Likewise. (fixup_reorder_chain): Likewise. (cfg_layout_merge_blocks): Likewise. * stmt.c (emit_case_nodes): Likewise. gcc/lto: 2012-09-19 Dehao Chen <dehao@google.com> * lto/lto.c (lto_fixup_prevailing_decls): Remove tree.exp.block field. libcpp: 2012-09-19 Dehao Chen <dehao@google.com> * include/line-map.h (MAX_SOURCE_LOCATION): New value. (location_adhoc_data_fini): New. (get_combined_adhoc_loc): New. (get_data_from_adhoc_loc): New. (get_location_from_adhoc_loc): New. (location_adhoc_data_map): New. (COMBINE_LOCATION_DATA): New. (IS_ADHOC_LOC): New. (expanded_location): New field. (line_maps): New field. * line-map.c (location_adhoc_data): New. (location_adhoc_data_hash): New. (location_adhoc_data_eq): New. (location_adhoc_data_update): New. (get_combined_adhoc_loc): New. (get_data_from_adhoc_loc): New. (get_location_from_adhoc_loc): New. (location_adhoc_data_init): New. (location_adhoc_data_fini): New. (linemap_init): Initialize location_adhoc_data. (linemap_lookup): Change to use new location. (linemap_ordinary_map_lookup): Likewise. (linemap_macro_map_lookup): Likewise. (linemap_macro_map_loc_to_def_point): Likewise. (linemap_macro_map_loc_unwind_toward_spel): Likewise. (linemap_get_expansion_line): Likewise. (linemap_get_expansion_filename): Likewise. (linemap_location_in_system_header_p): Likewise. (linemap_location_from_macro_expansion_p): Likewise. (linemap_macro_loc_to_spelling_point): Likewise. (linemap_macro_loc_to_def_point): Likewise. (linemap_macro_loc_to_exp_point): Likewise. (linemap_resolve_location): Likewise. (linemap_unwind_toward_expansion): Likewise. (linemap_unwind_to_first_non_reserved_loc): Likewise. (linemap_expand_location): Likewise. (linemap_dump_location): Likewise. (linemap_line_start): Likewise. From-SVN: r191494
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog41
-rw-r--r--libcpp/include/line-map.h42
-rw-r--r--libcpp/line-map.c174
3 files changed, 254 insertions, 3 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 7c11fdd0..ab0e2ec 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,44 @@
+2012-09-19 Dehao Chen <dehao@google.com>
+
+ * include/line-map.h (MAX_SOURCE_LOCATION): New value.
+ (location_adhoc_data_fini): New.
+ (get_combined_adhoc_loc): New.
+ (get_data_from_adhoc_loc): New.
+ (get_location_from_adhoc_loc): New.
+ (location_adhoc_data_map): New.
+ (COMBINE_LOCATION_DATA): New.
+ (IS_ADHOC_LOC): New.
+ (expanded_location): New field.
+ (line_maps): New field.
+ * line-map.c (location_adhoc_data): New.
+ (location_adhoc_data_hash): New.
+ (location_adhoc_data_eq): New.
+ (location_adhoc_data_update): New.
+ (get_combined_adhoc_loc): New.
+ (get_data_from_adhoc_loc): New.
+ (get_location_from_adhoc_loc): New.
+ (location_adhoc_data_init): New.
+ (location_adhoc_data_fini): New.
+ (linemap_init): Initialize location_adhoc_data.
+ (linemap_lookup): Change to use new location.
+ (linemap_ordinary_map_lookup): Likewise.
+ (linemap_macro_map_lookup): Likewise.
+ (linemap_macro_map_loc_to_def_point): Likewise.
+ (linemap_macro_map_loc_unwind_toward_spel): Likewise.
+ (linemap_get_expansion_line): Likewise.
+ (linemap_get_expansion_filename): Likewise.
+ (linemap_location_in_system_header_p): Likewise.
+ (linemap_location_from_macro_expansion_p): Likewise.
+ (linemap_macro_loc_to_spelling_point): Likewise.
+ (linemap_macro_loc_to_def_point): Likewise.
+ (linemap_macro_loc_to_exp_point): Likewise.
+ (linemap_resolve_location): Likewise.
+ (linemap_unwind_toward_expansion): Likewise.
+ (linemap_unwind_to_first_non_reserved_loc): Likewise.
+ (linemap_expand_location): Likewise.
+ (linemap_dump_location): Likewise.
+ (linemap_line_start): Likewise.
+
2012-05-25 Dodji Seketeli <dodji@redhat.com>
PR preprocessor/53469
diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h
index 407ce4b..86f8383 100644
--- a/libcpp/include/line-map.h
+++ b/libcpp/include/line-map.h
@@ -89,7 +89,7 @@ struct GTY(()) line_map_ordinary {
/* This is the highest possible source location encoded within an
ordinary or macro map. */
-#define MAX_SOURCE_LOCATION 0xFFFFFFFF
+#define MAX_SOURCE_LOCATION 0x7FFFFFFF
struct cpp_hashnode;
@@ -259,6 +259,31 @@ struct GTY(()) maps_info {
unsigned int cache;
};
+/* Data structure to associate an arbitrary data to a source location. */
+struct location_adhoc_data {
+ source_location locus;
+ void *data;
+};
+
+struct htab;
+
+/* The following data structure encodes a location with some adhoc data
+ and maps it to a new unsigned integer (called an adhoc location)
+ that replaces the original location to represent the mapping.
+
+ The new adhoc_loc uses the highest bit as the enabling bit, i.e. if the
+ highest bit is 1, then the number is adhoc_loc. Otherwise, it serves as
+ the original location. Once identified as the adhoc_loc, the lower 31
+ bits of the integer is used to index the location_adhoc_data array,
+ in which the locus and associated data is stored. */
+
+struct location_adhoc_data_map {
+ struct htab *htab;
+ source_location curr_loc;
+ struct location_adhoc_data *data;
+ unsigned int allocated;
+};
+
/* A set of chronological line_map structures. */
struct GTY(()) line_maps {
@@ -289,6 +314,8 @@ struct GTY(()) line_maps {
/* The allocators' function used to know the actual size it
allocated, for a certain allocation size requested. */
line_map_round_alloc_size_func round_alloc_size;
+
+ struct location_adhoc_data_map GTY((skip)) location_adhoc_data_map;
};
/* Returns the pointer to the memory region where information about
@@ -408,6 +435,17 @@ struct GTY(()) line_maps {
#define LINEMAPS_LAST_ALLOCATED_MACRO_MAP(SET) \
LINEMAPS_LAST_ALLOCATED_MAP (SET, true)
+extern void location_adhoc_data_fini (struct line_maps *);
+extern source_location get_combined_adhoc_loc (struct line_maps *,
+ source_location, void *);
+extern void *get_data_from_adhoc_loc (struct line_maps *, source_location);
+extern source_location get_location_from_adhoc_loc (struct line_maps *,
+ source_location);
+
+#define IS_ADHOC_LOC(LOC) (((LOC) & MAX_SOURCE_LOCATION) != (LOC))
+#define COMBINE_LOCATION_DATA(SET, LOC, BLOCK) \
+ get_combined_adhoc_loc ((SET), (LOC), (BLOCK))
+
/* Initialize a line map set. */
extern void linemap_init (struct line_maps *);
@@ -594,6 +632,8 @@ typedef struct
int column;
+ void *data;
+
/* In a system header?. */
bool sysp;
} expanded_location;
diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index 7c4e389..54da4bc 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -25,6 +25,7 @@ along with this program; see the file COPYING3. If not see
#include "line-map.h"
#include "cpplib.h"
#include "internal.h"
+#include "hashtab.h"
static void trace_include (const struct line_maps *, const struct line_map *);
static const struct line_map * linemap_ordinary_map_lookup (struct line_maps *,
@@ -50,6 +51,120 @@ static source_location linemap_macro_loc_to_exp_point (struct line_maps *,
extern unsigned num_expanded_macros_counter;
extern unsigned num_macro_tokens_counter;
+/* Hash function for location_adhoc_data hashtable. */
+
+static hashval_t
+location_adhoc_data_hash (const void *l)
+{
+ const struct location_adhoc_data *lb =
+ (const struct location_adhoc_data *) l;
+ return (hashval_t) lb->locus + (size_t) &lb->data;
+}
+
+/* Compare function for location_adhoc_data hashtable. */
+
+static int
+location_adhoc_data_eq (const void *l1, const void *l2)
+{
+ const struct location_adhoc_data *lb1 =
+ (const struct location_adhoc_data *) l1;
+ const struct location_adhoc_data *lb2 =
+ (const struct location_adhoc_data *) l2;
+ return lb1->locus == lb2->locus && lb1->data == lb2->data;
+}
+
+/* Update the hashtable when location_adhoc_data is reallocated. */
+
+static int
+location_adhoc_data_update (void **slot, void *data)
+{
+ *((char **) slot) += *((long long *) data);
+ return 1;
+}
+
+/* Combine LOCUS and DATA to a combined adhoc loc. */
+
+source_location
+get_combined_adhoc_loc (struct line_maps *set,
+ source_location locus, void *data)
+{
+ struct location_adhoc_data lb;
+ struct location_adhoc_data **slot;
+
+ linemap_assert (data);
+
+ if (IS_ADHOC_LOC (locus))
+ locus =
+ set->location_adhoc_data_map.data[locus & MAX_SOURCE_LOCATION].locus;
+ if (locus == 0 && data == NULL)
+ return 0;
+ lb.locus = locus;
+ lb.data = data;
+ slot = (struct location_adhoc_data **)
+ htab_find_slot (set->location_adhoc_data_map.htab, &lb, INSERT);
+ if (*slot == NULL)
+ {
+ if (set->location_adhoc_data_map.curr_loc >=
+ set->location_adhoc_data_map.allocated)
+ {
+ char *orig_data = (char *) set->location_adhoc_data_map.data;
+ long long offset;
+ set->location_adhoc_data_map.allocated *= 2;
+ set->location_adhoc_data_map.data =
+ XRESIZEVEC (struct location_adhoc_data,
+ set->location_adhoc_data_map.data,
+ set->location_adhoc_data_map.allocated);
+ offset = (char *) (set->location_adhoc_data_map.data) - orig_data;
+ htab_traverse (set->location_adhoc_data_map.htab,
+ location_adhoc_data_update, &offset);
+ }
+ *slot = set->location_adhoc_data_map.data
+ + set->location_adhoc_data_map.curr_loc;
+ set->location_adhoc_data_map.data[
+ set->location_adhoc_data_map.curr_loc++] = lb;
+ }
+ return ((*slot) - set->location_adhoc_data_map.data) | 0x80000000;
+}
+
+/* Return the data for the adhoc loc. */
+
+void *
+get_data_from_adhoc_loc (struct line_maps *set, source_location loc)
+{
+ linemap_assert (IS_ADHOC_LOC (loc));
+ return set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].data;
+}
+
+/* Return the location for the adhoc loc. */
+
+source_location
+get_location_from_adhoc_loc (struct line_maps *set, source_location loc)
+{
+ linemap_assert (IS_ADHOC_LOC (loc));
+ return set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
+}
+
+/* Initialize the location_adhoc_data structure. */
+
+static void
+location_adhoc_data_init (struct line_maps *set)
+{
+ set->location_adhoc_data_map.htab =
+ htab_create (100, location_adhoc_data_hash, location_adhoc_data_eq, NULL);
+ set->location_adhoc_data_map.curr_loc = 0;
+ set->location_adhoc_data_map.allocated = 100;
+ set->location_adhoc_data_map.data = XNEWVEC (struct location_adhoc_data, 100);
+}
+
+/* Finalize the location_adhoc_data structure. */
+void
+location_adhoc_data_fini (struct line_maps *set)
+{
+ set->location_adhoc_data_map.allocated = 0;
+ XDELETEVEC (set->location_adhoc_data_map.data);
+ htab_delete (set->location_adhoc_data_map.htab);
+}
+
/* Initialize a line map set. */
void
@@ -58,6 +173,7 @@ linemap_init (struct line_maps *set)
memset (set, 0, sizeof (struct line_maps));
set->highest_location = RESERVED_LOCATION_COUNT - 1;
set->highest_line = RESERVED_LOCATION_COUNT - 1;
+ location_adhoc_data_init (set);
}
/* Check for and warn about line_maps entered but not exited. */
@@ -408,12 +524,12 @@ linemap_line_start (struct line_maps *set, linenum_type to_line,
if (add_map)
{
int column_bits;
- if (max_column_hint > 100000 || highest > 0xC0000000)
+ if (max_column_hint > 100000 || highest > 0x60000000)
{
/* If the column number is ridiculous or we've allocated a huge
number of source_locations, give up on column numbers. */
max_column_hint = 0;
- if (highest >0xF0000000)
+ if (highest >0x70000000)
return 0;
column_bits = 0;
}
@@ -509,6 +625,8 @@ linemap_position_for_line_and_column (struct line_map *map,
const struct line_map*
linemap_lookup (struct line_maps *set, source_location line)
{
+ if (IS_ADHOC_LOC (line))
+ line = set->location_adhoc_data_map.data[line & MAX_SOURCE_LOCATION].locus;
if (linemap_location_from_macro_expansion_p (set, line))
return linemap_macro_map_lookup (set, line);
return linemap_ordinary_map_lookup (set, line);
@@ -525,6 +643,9 @@ linemap_ordinary_map_lookup (struct line_maps *set, source_location line)
unsigned int md, mn, mx;
const struct line_map *cached, *result;
+ if (IS_ADHOC_LOC (line))
+ line = set->location_adhoc_data_map.data[line & MAX_SOURCE_LOCATION].locus;
+
if (set == NULL || line < RESERVED_LOCATION_COUNT)
return NULL;
@@ -570,6 +691,9 @@ linemap_macro_map_lookup (struct line_maps *set, source_location line)
unsigned int md, mn, mx;
const struct line_map *cached, *result;
+ if (IS_ADHOC_LOC (line))
+ line = set->location_adhoc_data_map.data[line & MAX_SOURCE_LOCATION].locus;
+
linemap_assert (line >= LINEMAPS_MACRO_LOWEST_LOCATION (set));
if (set == NULL)
@@ -696,6 +820,10 @@ linemap_get_expansion_line (struct line_maps *set,
{
const struct line_map *map = NULL;
+ if (IS_ADHOC_LOC (location))
+ location = set->location_adhoc_data_map.data[
+ location & MAX_SOURCE_LOCATION].locus;
+
if (location < RESERVED_LOCATION_COUNT)
return 0;
@@ -720,6 +848,10 @@ linemap_get_expansion_filename (struct line_maps *set,
{
const struct line_map *map = NULL;
+ if (IS_ADHOC_LOC (location))
+ location = set->location_adhoc_data_map.data[
+ location & MAX_SOURCE_LOCATION].locus;
+
if (location < RESERVED_LOCATION_COUNT)
return NULL;
@@ -754,6 +886,10 @@ linemap_location_in_system_header_p (struct line_maps *set,
{
const struct line_map *map = NULL;
+ if (IS_ADHOC_LOC (location))
+ location = set->location_adhoc_data_map.data[
+ location & MAX_SOURCE_LOCATION].locus;
+
if (location < RESERVED_LOCATION_COUNT)
return false;
@@ -793,6 +929,10 @@ bool
linemap_location_from_macro_expansion_p (struct line_maps *set,
source_location location)
{
+ if (IS_ADHOC_LOC (location))
+ location = set->location_adhoc_data_map.data[
+ location & MAX_SOURCE_LOCATION].locus;
+
linemap_assert (location <= MAX_SOURCE_LOCATION
&& (set->highest_location
< LINEMAPS_MACRO_LOWEST_LOCATION (set)));
@@ -933,6 +1073,10 @@ linemap_macro_loc_to_spelling_point (struct line_maps *set,
{
struct line_map *map;
+ if (IS_ADHOC_LOC (location))
+ location = set->location_adhoc_data_map.data[
+ location & MAX_SOURCE_LOCATION].locus;
+
linemap_assert (set && location >= RESERVED_LOCATION_COUNT);
while (true)
@@ -967,6 +1111,10 @@ linemap_macro_loc_to_def_point (struct line_maps *set,
{
struct line_map *map;
+ if (IS_ADHOC_LOC (location))
+ location = set->location_adhoc_data_map.data[
+ location & MAX_SOURCE_LOCATION].locus;
+
linemap_assert (set && location >= RESERVED_LOCATION_COUNT);
while (true)
@@ -1005,6 +1153,10 @@ linemap_macro_loc_to_exp_point (struct line_maps *set,
{
struct line_map *map;
+ if (IS_ADHOC_LOC (location))
+ location = set->location_adhoc_data_map.data[
+ location & MAX_SOURCE_LOCATION].locus;
+
linemap_assert (set && location >= RESERVED_LOCATION_COUNT);
while (true)
@@ -1074,6 +1226,9 @@ linemap_resolve_location (struct line_maps *set,
enum location_resolution_kind lrk,
const struct line_map **map)
{
+ if (IS_ADHOC_LOC (loc))
+ loc = set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
+
if (loc < RESERVED_LOCATION_COUNT)
{
/* A reserved location wasn't encoded in a map. Let's return a
@@ -1121,6 +1276,9 @@ linemap_unwind_toward_expansion (struct line_maps *set,
source_location resolved_location;
const struct line_map *resolved_map;
+ if (IS_ADHOC_LOC (loc))
+ loc = set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
+
resolved_location =
linemap_macro_map_loc_unwind_toward_spelling (*map, loc);
resolved_map = linemap_lookup (set, resolved_location);
@@ -1157,6 +1315,9 @@ linemap_unwind_to_first_non_reserved_loc (struct line_maps *set,
source_location resolved_loc;
const struct line_map *map0 = NULL, *map1 = NULL;
+ if (IS_ADHOC_LOC (loc))
+ loc = set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
+
map0 = linemap_lookup (set, loc);
if (!linemap_macro_expansion_map_p (map0))
return loc;
@@ -1198,6 +1359,12 @@ linemap_expand_location (struct line_maps *set,
expanded_location xloc;
memset (&xloc, 0, sizeof (xloc));
+ if (IS_ADHOC_LOC (loc))
+ {
+ loc = set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
+ xloc.data = set->location_adhoc_data_map.data[
+ loc & MAX_SOURCE_LOCATION].data;
+ }
if (loc < RESERVED_LOCATION_COUNT)
/* The location for this token wasn't generated from a line map.
@@ -1290,6 +1457,9 @@ linemap_dump_location (struct line_maps *set,
const char *path = "", *from = "";
int l = -1, c = -1, s = -1, e = -1;
+ if (IS_ADHOC_LOC (loc))
+ loc = set->location_adhoc_data_map.data[loc & MAX_SOURCE_LOCATION].locus;
+
if (loc == 0)
return;