static void get_inline_stack (location_t locus, inline_stack *stack) { if (LOCATION_LOCUS (locus) == UNKNOWN_LOCATION) return; tree block = LOCATION_BLOCK (locus); if (block && TREE_CODE (block) == BLOCK) { int level = 0; for (block = BLOCK_SUPERCONTEXT (block); block && (TREE_CODE (block) == BLOCK); block = BLOCK_SUPERCONTEXT (block)) { location_t tmp_locus = BLOCK_SOURCE_LOCATION (block); if (LOCATION_LOCUS (tmp_locus) == UNKNOWN_LOCATION) continue; tree decl = get_function_decl_from_block (block); stack->safe_push ( std::make_pair (decl, get_combined_location (locus, decl))); locus = tmp_locus; level++; } } stack->safe_push ( std::make_pair (current_function_decl, get_combined_location (locus, current_function_decl))); }
static expanded_location expand_location_1 (source_location loc, bool expansion_point_p) { expanded_location xloc; const struct line_map *map; enum location_resolution_kind lrk = LRK_MACRO_EXPANSION_POINT; tree block = NULL; if (IS_ADHOC_LOC (loc)) { block = LOCATION_BLOCK (loc); loc = LOCATION_LOCUS (loc); } /* If LOC describes a location with a discriminator, extract the discriminator and map it to the real location. */ if (min_discriminator_location != UNKNOWN_LOCATION && loc >= min_discriminator_location && loc < next_discriminator_location) loc = map_discriminator_location (loc); memset (&xloc, 0, sizeof (xloc)); if (loc >= RESERVED_LOCATION_COUNT) { if (!expansion_point_p) { /* We want to resolve LOC to its spelling location. But if that spelling location is a reserved location that appears in the context of a macro expansion (like for a location for a built-in token), let's consider the first location (toward the expansion point) that is not reserved; that is, the first location that is in real source code. */ loc = linemap_unwind_to_first_non_reserved_loc (line_table, loc, &map); lrk = LRK_SPELLING_LOCATION; } loc = linemap_resolve_location (line_table, loc, lrk, &map); xloc = linemap_expand_location (line_table, map, loc); } xloc.data = block; if (loc <= BUILTINS_LOCATION) xloc.file = loc == UNKNOWN_LOCATION ? NULL : _("<built-in>"); return xloc; }