Eliminate source_location in favor of location_t
Historically GCC used location_t, while libcpp used source_location. This inconsistency has been annoying me for a while, so this patch removes source_location in favor of location_t throughout (as the latter is shorter). gcc/ChangeLog: * builtins.c: Replace "source_location" with "location_t". * diagnostic-show-locus.c: Likewise. * diagnostic.c: Likewise. * dumpfile.c: Likewise. * gcc-rich-location.h: Likewise. * genmatch.c: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * input.c: Likewise. * input.h: Likewise. Eliminate the typedef. * omp-expand.c: Likewise. * selftest.h: Likewise. * substring-locations.h (get_source_location_for_substring): Rename to.. (get_location_within_string): ...this. * tree-cfg.c: Replace "source_location" with "location_t". * tree-cfgcleanup.c: Likewise. * tree-diagnostic.c: Likewise. * tree-into-ssa.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-phinodes.c: Likewise. * tree-phinodes.h: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa.c: Likewise. * tree-ssa.h: Likewise. * tree-vect-loop-manip.c: Likewise. gcc/c-family/ChangeLog: * c-common.c (c_get_substring_location): Update for renaming of get_source_location_for_substring to get_location_within_string. * c-lex.c: Replace "source_location" with "location_t". * c-opts.c: Likewise. * c-ppoutput.c: Likewise. gcc/c/ChangeLog: * c-decl.c: Replace "source_location" with "location_t". * c-tree.h: Likewise. * c-typeck.c: Likewise. * gimple-parser.c: Likewise. gcc/cp/ChangeLog: * call.c: Replace "source_location" with "location_t". * cp-tree.h: Likewise. * cvt.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. * typeck.c: Likewise. gcc/fortran/ChangeLog: * cpp.c: Replace "source_location" with "location_t". * gfortran.h: Likewise. gcc/go/ChangeLog: * go-gcc-diagnostics.cc: Replace "source_location" with "location_t". * go-gcc.cc: Likewise. * go-linemap.cc: Likewise. * go-location.h: Likewise. * gofrontend/README: Likewise. gcc/jit/ChangeLog: * jit-playback.c: Replace "source_location" with "location_t". gcc/testsuite/ChangeLog: * g++.dg/plugin/comment_plugin.c: Replace "source_location" with "location_t". * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Likewise. libcc1/ChangeLog: * libcc1plugin.cc: Replace "source_location" with "location_t". (plugin_context::get_source_location): Rename to... (plugin_context::get_location_t): ...this. * libcp1plugin.cc: Likewise. libcpp/ChangeLog: * charset.c: Replace "source_location" with "location_t". * directives-only.c: Likewise. * directives.c: Likewise. * errors.c: Likewise. * expr.c: Likewise. * files.c: Likewise. * include/cpplib.h: Likewise. Rename MAX_SOURCE_LOCATION to MAX_LOCATION_T. * include/line-map.h: Likewise. * init.c: Likewise. * internal.h: Likewise. * lex.c: Likewise. * line-map.c: Likewise. * location-example.txt: Likewise. * macro.c: Likewise. * pch.c: Likewise. * traditional.c: Likewise. From-SVN: r266085
This commit is contained in:
parent
f9731de3db
commit
620e594be5
83 changed files with 840 additions and 734 deletions
|
@ -73,7 +73,7 @@ enum lc_reason
|
|||
LC_HWM /* High Water Mark. */
|
||||
};
|
||||
|
||||
/* The typedef "source_location" is a key within the location database,
|
||||
/* The typedef "location_t" is a key within the location database,
|
||||
identifying a source location or macro expansion, along with range
|
||||
information, and (optionally) a pointer for use by gcc.
|
||||
|
||||
|
@ -182,7 +182,7 @@ enum lc_reason
|
|||
| macromap[1]->start_location | Start of macro map 1
|
||||
-----------+-------------------------------+-------------------------------
|
||||
| macromap[0]->start_location | Start of macro map 0
|
||||
0x7fffffff | MAX_SOURCE_LOCATION | Also used as a mask for
|
||||
0x7fffffff | MAX_LOCATION_T | Also used as a mask for
|
||||
| | accessing the ad-hoc data table
|
||||
-----------+-------------------------------+-------------------------------
|
||||
0x80000000 | Start of ad-hoc values; the lower 31 bits are used as an index
|
||||
|
@ -283,9 +283,9 @@ enum lc_reason
|
|||
finish == ordmap->start + (23 << 12) + (19 << 5)
|
||||
== ordmap->start + 0x17260
|
||||
|
||||
To further see how source_location works in practice, see the
|
||||
To further see how location_t works in practice, see the
|
||||
worked example in libcpp/location-example.txt. */
|
||||
typedef unsigned int source_location;
|
||||
typedef unsigned int location_t;
|
||||
|
||||
/* Do not track column numbers higher than this one. As a result, the
|
||||
range of column_bits is [12, 18] (or 0 if column numbers are
|
||||
|
@ -295,15 +295,15 @@ const unsigned int LINE_MAP_MAX_COLUMN_NUMBER = (1U << 12);
|
|||
/* Do not pack ranges if locations get higher than this.
|
||||
If you change this, update:
|
||||
gcc.dg/plugin/location-overflow-test-*.c. */
|
||||
const source_location LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES = 0x50000000;
|
||||
const location_t LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES = 0x50000000;
|
||||
|
||||
/* Do not track column numbers if locations get higher than this.
|
||||
If you change this, update:
|
||||
gcc.dg/plugin/location-overflow-test-*.c. */
|
||||
const source_location LINE_MAP_MAX_LOCATION_WITH_COLS = 0x60000000;
|
||||
const location_t LINE_MAP_MAX_LOCATION_WITH_COLS = 0x60000000;
|
||||
|
||||
/* Highest possible source location encoded within an ordinary map. */
|
||||
const source_location LINE_MAP_MAX_LOCATION = 0x70000000;
|
||||
const location_t LINE_MAP_MAX_LOCATION = 0x70000000;
|
||||
|
||||
/* A range of source locations.
|
||||
|
||||
|
@ -315,15 +315,15 @@ const source_location LINE_MAP_MAX_LOCATION = 0x70000000;
|
|||
let's do it the simple way, as a pair. */
|
||||
struct GTY(()) source_range
|
||||
{
|
||||
source_location m_start;
|
||||
source_location m_finish;
|
||||
location_t m_start;
|
||||
location_t m_finish;
|
||||
|
||||
/* We avoid using constructors, since various structs that
|
||||
don't yet have constructors will embed instances of
|
||||
source_range. */
|
||||
|
||||
/* Make a source_range from a source_location. */
|
||||
static source_range from_location (source_location loc)
|
||||
/* Make a source_range from a location_t. */
|
||||
static source_range from_location (location_t loc)
|
||||
{
|
||||
source_range result;
|
||||
result.m_start = loc;
|
||||
|
@ -331,9 +331,9 @@ struct GTY(()) source_range
|
|||
return result;
|
||||
}
|
||||
|
||||
/* Make a source_range from a pair of source_location. */
|
||||
static source_range from_locations (source_location start,
|
||||
source_location finish)
|
||||
/* Make a source_range from a pair of location_t. */
|
||||
static source_range from_locations (location_t start,
|
||||
location_t finish)
|
||||
{
|
||||
source_range result;
|
||||
result.m_start = start;
|
||||
|
@ -379,7 +379,7 @@ typedef size_t (*line_map_round_alloc_size_func) (size_t);
|
|||
/* This contains GTY mark-up to support precompiled headers.
|
||||
line_map is an abstract class, only derived objects exist. */
|
||||
struct GTY((tag ("0"), desc ("MAP_ORDINARY_P (&%h) ? 1 : 2"))) line_map {
|
||||
source_location start_location;
|
||||
location_t start_location;
|
||||
|
||||
/* Size and alignment is (usually) 4 bytes. */
|
||||
};
|
||||
|
@ -395,7 +395,7 @@ struct GTY((tag ("0"), desc ("MAP_ORDINARY_P (&%h) ? 1 : 2"))) line_map {
|
|||
(The top line is line 1 and the leftmost column is column 1; line/column 0
|
||||
means "entire file/line" or "unknown line/column" or "not applicable".)
|
||||
|
||||
The highest possible source location is MAX_SOURCE_LOCATION. */
|
||||
The highest possible source location is MAX_LOCATION_T. */
|
||||
struct GTY((tag ("1"))) line_map_ordinary : public line_map {
|
||||
/* Base class is 4 bytes. */
|
||||
|
||||
|
@ -410,7 +410,7 @@ struct GTY((tag ("1"))) line_map_ordinary : public line_map {
|
|||
cpp_buffer. */
|
||||
unsigned char sysp;
|
||||
|
||||
/* Number of the low-order source_location bits used for column numbers
|
||||
/* Number of the low-order location_t bits used for column numbers
|
||||
and ranges. */
|
||||
unsigned int m_column_and_range_bits : 8;
|
||||
|
||||
|
@ -437,14 +437,14 @@ struct GTY((tag ("1"))) line_map_ordinary : public line_map {
|
|||
/* Location from whence this line map was included. For regular
|
||||
#includes, this location will be the last location of a map. For
|
||||
outermost file, this is 0. */
|
||||
source_location included_from;
|
||||
location_t included_from;
|
||||
|
||||
/* Size is 20 or 24 bytes, no padding */
|
||||
};
|
||||
|
||||
/* This is the highest possible source location encoded within an
|
||||
ordinary or macro map. */
|
||||
const source_location MAX_SOURCE_LOCATION = 0x7FFFFFFF;
|
||||
const location_t MAX_LOCATION_T = 0x7FFFFFFF;
|
||||
|
||||
struct cpp_hashnode;
|
||||
|
||||
|
@ -521,14 +521,14 @@ struct GTY((tag ("2"))) line_map_macro : public line_map {
|
|||
In the example above x1 (for token "+") is going to be the same
|
||||
as y1. x0 is the spelling location for the argument token "1",
|
||||
and x2 is the spelling location for the argument token "2". */
|
||||
source_location * GTY((atomic)) macro_locations;
|
||||
location_t * GTY((atomic)) macro_locations;
|
||||
|
||||
/* This is the location of the expansion point of the current macro
|
||||
map. It's the location of the macro name. That location is held
|
||||
by the map that was current right before the current one. It
|
||||
could have been either a macro or an ordinary map, depending on
|
||||
if we are in a nested expansion context not. */
|
||||
source_location expansion;
|
||||
location_t expansion;
|
||||
|
||||
/* Size is 20 or 32 (4 bytes padding on 64-bit). */
|
||||
};
|
||||
|
@ -561,19 +561,19 @@ struct GTY((tag ("2"))) line_map_macro : public line_map {
|
|||
/* Get whether location LOC is an ad-hoc, ordinary or macro location. */
|
||||
|
||||
inline bool
|
||||
IS_ORDINARY_LOC (source_location loc)
|
||||
IS_ORDINARY_LOC (location_t loc)
|
||||
{
|
||||
return loc < LINE_MAP_MAX_LOCATION;
|
||||
}
|
||||
|
||||
inline bool
|
||||
IS_ADHOC_LOC (source_location loc)
|
||||
IS_ADHOC_LOC (location_t loc)
|
||||
{
|
||||
return loc > MAX_SOURCE_LOCATION;
|
||||
return loc > MAX_LOCATION_T;
|
||||
}
|
||||
|
||||
inline bool
|
||||
IS_MACRO_LOC (source_location loc)
|
||||
IS_MACRO_LOC (location_t loc)
|
||||
{
|
||||
return !IS_ORDINARY_LOC (loc) && !IS_ADHOC_LOC (loc);
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ linemap_check_macro (const line_map *map)
|
|||
|
||||
/* Read the start location of MAP. */
|
||||
|
||||
inline source_location
|
||||
inline location_t
|
||||
MAP_START_LOCATION (const line_map *map)
|
||||
{
|
||||
return map->start_location;
|
||||
|
@ -687,7 +687,7 @@ MACRO_MAP_NUM_MACRO_TOKENS (const line_map_macro *macro_map)
|
|||
/* Get the array of pairs of locations within macro map MAP.
|
||||
See the declaration of line_map_macro for more information. */
|
||||
|
||||
inline source_location *
|
||||
inline location_t *
|
||||
MACRO_MAP_LOCATIONS (const line_map_macro *macro_map)
|
||||
{
|
||||
return macro_map->macro_locations;
|
||||
|
@ -695,7 +695,7 @@ MACRO_MAP_LOCATIONS (const line_map_macro *macro_map)
|
|||
|
||||
/* Get the location of the expansion point of the macro map MAP. */
|
||||
|
||||
inline source_location
|
||||
inline location_t
|
||||
MACRO_MAP_EXPANSION_POINT_LOCATION (const line_map_macro *macro_map)
|
||||
{
|
||||
return macro_map->expansion;
|
||||
|
@ -742,7 +742,7 @@ struct GTY(()) maps_info_macro {
|
|||
/* Data structure to associate a source_range together with an arbitrary
|
||||
data pointer with a source location. */
|
||||
struct GTY(()) location_adhoc_data {
|
||||
source_location locus;
|
||||
location_t locus;
|
||||
source_range src_range;
|
||||
void * GTY((skip)) data;
|
||||
};
|
||||
|
@ -761,7 +761,7 @@ struct htab;
|
|||
|
||||
struct GTY(()) location_adhoc_data_map {
|
||||
struct htab * GTY((skip)) htab;
|
||||
source_location curr_loc;
|
||||
location_t curr_loc;
|
||||
unsigned int allocated;
|
||||
struct location_adhoc_data GTY((length ("%h.allocated"))) *data;
|
||||
};
|
||||
|
@ -781,11 +781,11 @@ struct GTY(()) line_maps {
|
|||
/* If true, prints an include trace a la -H. */
|
||||
bool trace_includes;
|
||||
|
||||
/* Highest source_location "given out". */
|
||||
source_location highest_location;
|
||||
/* Highest location_t "given out". */
|
||||
location_t highest_location;
|
||||
|
||||
/* Start of line of highest source_location "given out". */
|
||||
source_location highest_line;
|
||||
/* Start of line of highest location_t "given out". */
|
||||
location_t highest_line;
|
||||
|
||||
/* The maximum column number we can quickly allocate. Higher numbers
|
||||
may require allocating a new line_map. */
|
||||
|
@ -802,7 +802,7 @@ struct GTY(()) line_maps {
|
|||
|
||||
/* The special location value that is used as spelling location for
|
||||
built-in tokens. */
|
||||
source_location builtin_location;
|
||||
location_t builtin_location;
|
||||
|
||||
/* True if we've seen a #line or # 44 "file" directive. */
|
||||
bool seen_line_directive;
|
||||
|
@ -1032,12 +1032,12 @@ LINEMAPS_LAST_MACRO_MAP (const line_maps *set)
|
|||
|
||||
/* Returns the lowest location [of a token resulting from macro
|
||||
expansion] encoded in this line table. */
|
||||
inline source_location
|
||||
inline location_t
|
||||
LINEMAPS_MACRO_LOWEST_LOCATION (const line_maps *set)
|
||||
{
|
||||
return LINEMAPS_MACRO_USED (set)
|
||||
? MAP_START_LOCATION (LINEMAPS_LAST_MACRO_MAP (set))
|
||||
: MAX_SOURCE_LOCATION + 1;
|
||||
: MAX_LOCATION_T + 1;
|
||||
}
|
||||
|
||||
/* Returns the last macro map allocated in the line table SET. */
|
||||
|
@ -1047,33 +1047,33 @@ LINEMAPS_LAST_ALLOCATED_MACRO_MAP (const line_maps *set)
|
|||
return (line_map_macro *)LINEMAPS_LAST_ALLOCATED_MAP (set, true);
|
||||
}
|
||||
|
||||
extern source_location get_combined_adhoc_loc (struct line_maps *,
|
||||
source_location,
|
||||
extern location_t get_combined_adhoc_loc (struct line_maps *,
|
||||
location_t,
|
||||
source_range,
|
||||
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);
|
||||
extern void *get_data_from_adhoc_loc (struct line_maps *, location_t);
|
||||
extern location_t get_location_from_adhoc_loc (struct line_maps *,
|
||||
location_t);
|
||||
|
||||
extern source_range get_range_from_loc (line_maps *set, source_location loc);
|
||||
extern source_range get_range_from_loc (line_maps *set, location_t loc);
|
||||
|
||||
/* Get whether location LOC is a "pure" location, or
|
||||
whether it is an ad-hoc location, or embeds range information. */
|
||||
|
||||
bool
|
||||
pure_location_p (line_maps *set, source_location loc);
|
||||
pure_location_p (line_maps *set, location_t loc);
|
||||
|
||||
/* Given location LOC within SET, strip away any packed range information
|
||||
or ad-hoc information. */
|
||||
|
||||
extern source_location get_pure_location (line_maps *set,
|
||||
source_location loc);
|
||||
extern location_t get_pure_location (line_maps *set,
|
||||
location_t loc);
|
||||
|
||||
/* Combine LOC and BLOCK, giving a combined adhoc location. */
|
||||
|
||||
inline source_location
|
||||
inline location_t
|
||||
COMBINE_LOCATION_DATA (struct line_maps *set,
|
||||
source_location loc,
|
||||
location_t loc,
|
||||
source_range src_range,
|
||||
void *block)
|
||||
{
|
||||
|
@ -1087,19 +1087,19 @@ extern void rebuild_location_adhoc_htab (struct line_maps *);
|
|||
spelling location for built-in tokens. This BUILTIN_LOCATION has
|
||||
to be strictly less than RESERVED_LOCATION_COUNT. */
|
||||
extern void linemap_init (struct line_maps *set,
|
||||
source_location builtin_location);
|
||||
location_t builtin_location);
|
||||
|
||||
/* Check for and warn about line_maps entered but not exited. */
|
||||
|
||||
extern void linemap_check_files_exited (struct line_maps *);
|
||||
|
||||
/* Return a source_location for the start (i.e. column==0) of
|
||||
/* Return a location_t for the start (i.e. column==0) of
|
||||
(physical) line TO_LINE in the current source file (as in the
|
||||
most recent linemap_add). MAX_COLUMN_HINT is the highest column
|
||||
number we expect to use in this line (but it does not change
|
||||
the highest_location). */
|
||||
|
||||
extern source_location linemap_line_start
|
||||
extern location_t linemap_line_start
|
||||
(struct line_maps *set, linenum_type to_line, unsigned int max_column_hint);
|
||||
|
||||
/* Add a mapping of logical source line to physical source file and
|
||||
|
@ -1126,7 +1126,7 @@ extern const struct line_map *linemap_add
|
|||
binary search. If no line map have been allocated yet, this
|
||||
function returns NULL. */
|
||||
extern const struct line_map *linemap_lookup
|
||||
(struct line_maps *, source_location);
|
||||
(struct line_maps *, location_t);
|
||||
|
||||
/* Returns TRUE if the line table set tracks token locations across
|
||||
macro expansion, FALSE otherwise. */
|
||||
|
@ -1145,49 +1145,49 @@ const char* linemap_map_get_macro_name (const line_map_macro *);
|
|||
that is part of a macro replacement-list defined in a system
|
||||
header, but expanded in a non-system file. */
|
||||
int linemap_location_in_system_header_p (struct line_maps *,
|
||||
source_location);
|
||||
location_t);
|
||||
|
||||
/* Return TRUE if LOCATION is a source code location of a token that is part of
|
||||
a macro expansion, FALSE otherwise. */
|
||||
bool linemap_location_from_macro_expansion_p (const struct line_maps *,
|
||||
source_location);
|
||||
location_t);
|
||||
|
||||
/* TRUE if LOCATION is a source code location of a token that is part of the
|
||||
definition of a macro, FALSE otherwise. */
|
||||
bool linemap_location_from_macro_definition_p (struct line_maps *,
|
||||
source_location);
|
||||
location_t);
|
||||
|
||||
/* With the precondition that LOCATION is the locus of a token that is
|
||||
an argument of a function-like macro MACRO_MAP and appears in the
|
||||
expansion of MACRO_MAP, return the locus of that argument in the
|
||||
context of the caller of MACRO_MAP. */
|
||||
|
||||
extern source_location linemap_macro_map_loc_unwind_toward_spelling
|
||||
(line_maps *set, const line_map_macro *macro_map, source_location location);
|
||||
extern location_t linemap_macro_map_loc_unwind_toward_spelling
|
||||
(line_maps *set, const line_map_macro *macro_map, location_t location);
|
||||
|
||||
/* source_location values from 0 to RESERVED_LOCATION_COUNT-1 will
|
||||
/* location_t values from 0 to RESERVED_LOCATION_COUNT-1 will
|
||||
be reserved for libcpp user as special values, no token from libcpp
|
||||
will contain any of those locations. */
|
||||
const source_location RESERVED_LOCATION_COUNT = 2;
|
||||
const location_t RESERVED_LOCATION_COUNT = 2;
|
||||
|
||||
/* Converts a map and a source_location to source line. */
|
||||
/* Converts a map and a location_t to source line. */
|
||||
inline linenum_type
|
||||
SOURCE_LINE (const line_map_ordinary *ord_map, source_location loc)
|
||||
SOURCE_LINE (const line_map_ordinary *ord_map, location_t loc)
|
||||
{
|
||||
return ((loc - ord_map->start_location)
|
||||
>> ord_map->m_column_and_range_bits) + ord_map->to_line;
|
||||
}
|
||||
|
||||
/* Convert a map and source_location to source column number. */
|
||||
/* Convert a map and location_t to source column number. */
|
||||
inline linenum_type
|
||||
SOURCE_COLUMN (const line_map_ordinary *ord_map, source_location loc)
|
||||
SOURCE_COLUMN (const line_map_ordinary *ord_map, location_t loc)
|
||||
{
|
||||
return ((loc - ord_map->start_location)
|
||||
& ((1 << ord_map->m_column_and_range_bits) - 1)) >> ord_map->m_range_bits;
|
||||
}
|
||||
|
||||
|
||||
inline source_location
|
||||
inline location_t
|
||||
linemap_included_from (const line_map_ordinary *ord_map)
|
||||
{
|
||||
return ord_map->included_from;
|
||||
|
@ -1205,26 +1205,26 @@ MAIN_FILE_P (const line_map_ordinary *ord_map)
|
|||
return ord_map->included_from == 0;
|
||||
}
|
||||
|
||||
/* Encode and return a source_location from a column number. The
|
||||
/* Encode and return a location_t from a column number. The
|
||||
source line considered is the last source line used to call
|
||||
linemap_line_start, i.e, the last source line which a location was
|
||||
encoded from. */
|
||||
extern source_location
|
||||
extern location_t
|
||||
linemap_position_for_column (struct line_maps *, unsigned int);
|
||||
|
||||
/* Encode and return a source location from a given line and
|
||||
column. */
|
||||
source_location
|
||||
location_t
|
||||
linemap_position_for_line_and_column (line_maps *set,
|
||||
const line_map_ordinary *,
|
||||
linenum_type, unsigned int);
|
||||
|
||||
/* Encode and return a source_location starting from location LOC and
|
||||
/* Encode and return a location_t starting from location LOC and
|
||||
shifting it by OFFSET columns. This function does not support
|
||||
virtual locations. */
|
||||
source_location
|
||||
location_t
|
||||
linemap_position_for_loc_and_offset (struct line_maps *set,
|
||||
source_location loc,
|
||||
location_t loc,
|
||||
unsigned int offset);
|
||||
|
||||
/* Return the file this map is for. */
|
||||
|
@ -1256,16 +1256,16 @@ LINEMAP_SYSP (const line_map_ordinary *ord_map)
|
|||
the same token as the token for POST, and a negative value
|
||||
otherwise. */
|
||||
int linemap_compare_locations (struct line_maps *set,
|
||||
source_location pre,
|
||||
source_location post);
|
||||
location_t pre,
|
||||
location_t post);
|
||||
|
||||
/* Return TRUE if LOC_A denotes the location a token that comes
|
||||
topogically before the token denoted by location LOC_B, or if they
|
||||
are equal. */
|
||||
inline bool
|
||||
linemap_location_before_p (struct line_maps *set,
|
||||
source_location loc_a,
|
||||
source_location loc_b)
|
||||
location_t loc_a,
|
||||
location_t loc_b)
|
||||
{
|
||||
return linemap_compare_locations (set, loc_a, loc_b) >= 0;
|
||||
}
|
||||
|
@ -1324,7 +1324,7 @@ enum range_display_kind
|
|||
|
||||
struct location_range
|
||||
{
|
||||
source_location m_loc;
|
||||
location_t m_loc;
|
||||
|
||||
enum range_display_kind m_range_display_kind;
|
||||
|
||||
|
@ -1607,7 +1607,7 @@ class fixit_hint;
|
|||
|
||||
Adding a fix-it hint can fail: for example, attempts to insert content
|
||||
at the transition between two line maps may fail due to there being no
|
||||
source_location (aka location_t) value to express the new location.
|
||||
location_t value to express the new location.
|
||||
|
||||
Attempts to add a fix-it hint within a macro expansion will fail.
|
||||
|
||||
|
@ -1637,24 +1637,24 @@ class rich_location
|
|||
/* Constructors. */
|
||||
|
||||
/* Constructing from a location. */
|
||||
rich_location (line_maps *set, source_location loc,
|
||||
rich_location (line_maps *set, location_t loc,
|
||||
const range_label *label = NULL);
|
||||
|
||||
/* Destructor. */
|
||||
~rich_location ();
|
||||
|
||||
/* Accessors. */
|
||||
source_location get_loc () const { return get_loc (0); }
|
||||
source_location get_loc (unsigned int idx) const;
|
||||
location_t get_loc () const { return get_loc (0); }
|
||||
location_t get_loc (unsigned int idx) const;
|
||||
|
||||
void
|
||||
add_range (source_location loc,
|
||||
add_range (location_t loc,
|
||||
enum range_display_kind range_display_kind
|
||||
= SHOW_RANGE_WITHOUT_CARET,
|
||||
const range_label *label = NULL);
|
||||
|
||||
void
|
||||
set_range (unsigned int idx, source_location loc,
|
||||
set_range (unsigned int idx, location_t loc,
|
||||
enum range_display_kind range_display_kind);
|
||||
|
||||
unsigned int get_num_locations () const { return m_ranges.count (); }
|
||||
|
@ -1678,7 +1678,7 @@ class rich_location
|
|||
|
||||
/* Suggest inserting NEW_CONTENT immediately before the start of WHERE. */
|
||||
void
|
||||
add_fixit_insert_before (source_location where,
|
||||
add_fixit_insert_before (location_t where,
|
||||
const char *new_content);
|
||||
|
||||
/* Suggest inserting NEW_CONTENT immediately after the end of the primary
|
||||
|
@ -1688,7 +1688,7 @@ class rich_location
|
|||
|
||||
/* Suggest inserting NEW_CONTENT immediately after the end of WHERE. */
|
||||
void
|
||||
add_fixit_insert_after (source_location where,
|
||||
add_fixit_insert_after (location_t where,
|
||||
const char *new_content);
|
||||
|
||||
/* Methods for adding removal fix-it hints. */
|
||||
|
@ -1700,7 +1700,7 @@ class rich_location
|
|||
/* Suggest removing the content covered between the start and finish
|
||||
of WHERE. */
|
||||
void
|
||||
add_fixit_remove (source_location where);
|
||||
add_fixit_remove (location_t where);
|
||||
|
||||
/* Suggest removing the content covered by SRC_RANGE. */
|
||||
void
|
||||
|
@ -1715,7 +1715,7 @@ class rich_location
|
|||
/* Suggest replacing the content between the start and finish of
|
||||
WHERE with NEW_CONTENT. */
|
||||
void
|
||||
add_fixit_replace (source_location where,
|
||||
add_fixit_replace (location_t where,
|
||||
const char *new_content);
|
||||
|
||||
/* Suggest replacing the content covered by SRC_RANGE with
|
||||
|
@ -1751,10 +1751,10 @@ class rich_location
|
|||
}
|
||||
|
||||
private:
|
||||
bool reject_impossible_fixit (source_location where);
|
||||
bool reject_impossible_fixit (location_t where);
|
||||
void stop_supporting_fixits ();
|
||||
void maybe_add_fixit (source_location start,
|
||||
source_location next_loc,
|
||||
void maybe_add_fixit (location_t start,
|
||||
location_t next_loc,
|
||||
const char *new_content);
|
||||
|
||||
public:
|
||||
|
@ -1843,16 +1843,16 @@ class range_label
|
|||
class fixit_hint
|
||||
{
|
||||
public:
|
||||
fixit_hint (source_location start,
|
||||
source_location next_loc,
|
||||
fixit_hint (location_t start,
|
||||
location_t next_loc,
|
||||
const char *new_content);
|
||||
~fixit_hint () { free (m_bytes); }
|
||||
|
||||
bool affects_line_p (const char *file, int line) const;
|
||||
source_location get_start_loc () const { return m_start; }
|
||||
source_location get_next_loc () const { return m_next_loc; }
|
||||
bool maybe_append (source_location start,
|
||||
source_location next_loc,
|
||||
location_t get_start_loc () const { return m_start; }
|
||||
location_t get_next_loc () const { return m_next_loc; }
|
||||
bool maybe_append (location_t start,
|
||||
location_t next_loc,
|
||||
const char *new_content);
|
||||
|
||||
const char *get_string () const { return m_bytes; }
|
||||
|
@ -1867,8 +1867,8 @@ class fixit_hint
|
|||
this is a half-open/half-closed range:
|
||||
[start, next_loc)
|
||||
so that we can support insertion via start == next_loc. */
|
||||
source_location m_start;
|
||||
source_location m_next_loc;
|
||||
location_t m_start;
|
||||
location_t m_next_loc;
|
||||
char *m_bytes;
|
||||
size_t m_len;
|
||||
};
|
||||
|
@ -1932,10 +1932,10 @@ enum location_resolution_kind
|
|||
resolves to a location reserved for the client code, like
|
||||
UNKNOWN_LOCATION or BUILTINS_LOCATION in GCC. */
|
||||
|
||||
source_location linemap_resolve_location (struct line_maps *,
|
||||
source_location loc,
|
||||
enum location_resolution_kind lrk,
|
||||
const line_map_ordinary **loc_map);
|
||||
location_t linemap_resolve_location (struct line_maps *,
|
||||
location_t loc,
|
||||
enum location_resolution_kind lrk,
|
||||
const line_map_ordinary **loc_map);
|
||||
|
||||
/* Suppose that LOC is the virtual location of a token coming from the
|
||||
expansion of a macro M. This function then steps up to get the
|
||||
|
@ -1944,9 +1944,9 @@ source_location linemap_resolve_location (struct line_maps *,
|
|||
the point where M' was expanded. LOC_MAP is an output parameter.
|
||||
When non-NULL, *LOC_MAP is set to the map of the returned
|
||||
location. */
|
||||
source_location linemap_unwind_toward_expansion (struct line_maps *,
|
||||
source_location loc,
|
||||
const struct line_map **loc_map);
|
||||
location_t linemap_unwind_toward_expansion (struct line_maps *,
|
||||
location_t loc,
|
||||
const struct line_map **loc_map);
|
||||
|
||||
/* If LOC is the virtual location of a token coming from the expansion
|
||||
of a macro M and if its spelling location is reserved (e.g, a
|
||||
|
@ -1962,9 +1962,9 @@ source_location linemap_unwind_toward_expansion (struct line_maps *,
|
|||
|
||||
*MAP is set to the map of the returned location if the later is
|
||||
different from LOC. */
|
||||
source_location linemap_unwind_to_first_non_reserved_loc (struct line_maps *,
|
||||
source_location loc,
|
||||
const struct line_map **map);
|
||||
location_t linemap_unwind_to_first_non_reserved_loc (struct line_maps *,
|
||||
location_t loc,
|
||||
const struct line_map **map);
|
||||
|
||||
/* Expand source code location LOC and return a user readable source
|
||||
code location. LOC must be a spelling (non-virtual) location. If
|
||||
|
@ -1972,7 +1972,7 @@ source_location linemap_unwind_to_first_non_reserved_loc (struct line_maps *,
|
|||
location is returned. */
|
||||
expanded_location linemap_expand_location (struct line_maps *,
|
||||
const struct line_map *,
|
||||
source_location loc);
|
||||
location_t loc);
|
||||
|
||||
/* Statistics about maps allocation and usage as returned by
|
||||
linemap_get_statistics. */
|
||||
|
@ -1999,7 +1999,7 @@ struct linemap_stats
|
|||
location emitted for that file. */
|
||||
bool linemap_get_file_highest_location (struct line_maps * set,
|
||||
const char *file_name,
|
||||
source_location *loc);
|
||||
location_t *loc);
|
||||
|
||||
/* Compute and return statistics about the memory consumption of some
|
||||
parts of the line table SET. */
|
||||
|
@ -2007,7 +2007,7 @@ void linemap_get_statistics (struct line_maps *, struct linemap_stats *);
|
|||
|
||||
/* Dump debugging information about source location LOC into the file
|
||||
stream STREAM. SET is the line map set LOC comes from. */
|
||||
void linemap_dump_location (struct line_maps *, source_location, FILE *);
|
||||
void linemap_dump_location (struct line_maps *, location_t, FILE *);
|
||||
|
||||
/* Dump line map at index IX in line table SET to STREAM. If STREAM
|
||||
is NULL, use stderr. IS_MACRO is true if the caller wants to
|
||||
|
@ -2019,7 +2019,7 @@ void linemap_dump (FILE *, struct line_maps *, unsigned, bool);
|
|||
specifies how many macro maps to dump. */
|
||||
void line_table_dump (FILE *, struct line_maps *, unsigned int, unsigned int);
|
||||
|
||||
/* An enum for distinguishing the various parts within a source_location. */
|
||||
/* An enum for distinguishing the various parts within a location_t. */
|
||||
|
||||
enum location_aspect
|
||||
{
|
||||
|
@ -2028,14 +2028,14 @@ enum location_aspect
|
|||
LOCATION_ASPECT_FINISH
|
||||
};
|
||||
|
||||
/* The rich_location class requires a way to expand source_location instances.
|
||||
/* The rich_location class requires a way to expand location_t instances.
|
||||
We would directly use expand_location_to_spelling_point, which is
|
||||
implemented in gcc/input.c, but we also need to use it for rich_location
|
||||
within genmatch.c.
|
||||
Hence we require client code of libcpp to implement the following
|
||||
symbol. */
|
||||
extern expanded_location
|
||||
linemap_client_expand_location_to_spelling_point (source_location,
|
||||
linemap_client_expand_location_to_spelling_point (location_t,
|
||||
enum location_aspect);
|
||||
|
||||
#endif /* !LIBCPP_LINE_MAP_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue