GCC Middle and Back End API Reference
substring-locations.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  substring_loc
 
class  format_string_diagnostic_t
 

Functions

const char * get_location_within_string (cpp_reader *pfile, file_cache &fc, string_concat_db *concats, location_t strloc, enum cpp_ttype type, int caret_idx, int start_idx, int end_idx, location_t *out_loc)
 

Function Documentation

◆ get_location_within_string()

const char * get_location_within_string ( cpp_reader * pfile,
file_cache & fc,
string_concat_db * concats,
location_t strloc,
enum cpp_ttype type,
int caret_idx,
int start_idx,
int end_idx,
location_t * out_loc )
extern
Implementation detail, for use when implementing
LANG_HOOKS_GET_SUBSTRING_LOCATION.   
Attempt to populate *OUT_LOC with source location information on the
given characters within the string literal found at STRLOC.
CARET_IDX, START_IDX, and END_IDX refer to offsets within the execution
character set.

For example, given CARET_IDX = 4, START_IDX = 3, END_IDX  = 7
and string literal "012345\n789"
*OUT_LOC is written to with:
  "012345\n789"
      ~^~~~~

If CONCATS is non-NULL, then any string literals that the token at
STRLOC was concatenated with are also considered.

This is implemented by re-parsing the relevant source line(s).

Return NULL if successful, or an error message if any errors occurred.
Error messages are intended for GCC developers (to help debugging) rather
than for end-users.   

References gcc_assert, gcc_checking_assert, get_substring_ranges_for_loc(), make_location(), and NULL.