diff options
author | Ian Lance Taylor <iant@golang.org> | 2022-02-11 15:02:44 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2022-02-11 15:02:44 -0800 |
commit | 9a510fb0970d3d9a4201bce8965cabe67850386b (patch) | |
tree | 43d7fd2bbfd7ad8c9625a718a5e8718889351994 /libcpp/include/line-map.h | |
parent | a6d3012b274f38b20e2a57162106f625746af6c6 (diff) | |
parent | 8dc2499aa62f768c6395c9754b8cabc1ce25c494 (diff) | |
download | gcc-9a510fb0970d3d9a4201bce8965cabe67850386b.zip gcc-9a510fb0970d3d9a4201bce8965cabe67850386b.tar.gz gcc-9a510fb0970d3d9a4201bce8965cabe67850386b.tar.bz2 |
Merge from trunk revision 8dc2499aa62f768c6395c9754b8cabc1ce25c494
Diffstat (limited to 'libcpp/include/line-map.h')
-rw-r--r-- | libcpp/include/line-map.h | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 464494b..8033572 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -1,5 +1,5 @@ /* Map (unsigned int) keys to (source file, line, column) triples. - Copyright (C) 2001-2021 Free Software Foundation, Inc. + Copyright (C) 2001-2022 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -83,7 +83,7 @@ enum lc_reason This key only has meaning in relation to a line_maps instance. Within gcc there is a single line_maps instance: "line_table", declared in - gcc/input.h and defined in gcc/input.c. + gcc/input.h and defined in gcc/input.cc. The values of the keys are intended to be internal to libcpp, but for ease-of-understanding the implementation, they are currently @@ -792,6 +792,9 @@ public: /* If true, prints an include trace a la -H. */ bool trace_includes; + /* True if we've seen a #line or # 44 "file" directive. */ + bool seen_line_directive; + /* Highest location_t "given out". */ location_t highest_location; @@ -803,11 +806,11 @@ public: unsigned int max_column_hint; /* The allocator to use when resizing 'maps', defaults to xrealloc. */ - line_map_realloc reallocator; + line_map_realloc GTY((callback)) reallocator; /* 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; + line_map_round_alloc_size_func GTY((callback)) round_alloc_size; struct location_adhoc_data_map location_adhoc_data_map; @@ -815,9 +818,6 @@ public: built-in tokens. */ location_t builtin_location; - /* True if we've seen a #line or # 44 "file" directive. */ - bool seen_line_directive; - /* The default value of range_bits in ordinary line maps. */ unsigned int default_range_bits; @@ -1787,6 +1787,18 @@ class rich_location const diagnostic_path *get_path () const { return m_path; } void set_path (const diagnostic_path *path) { m_path = path; } + /* A flag for hinting that the diagnostic involves character encoding + issues, and thus that it will be helpful to the user if we show some + representation of how the characters in the pertinent source lines + are encoded. + The default is false (i.e. do not escape). + When set to true, non-ASCII bytes in the pertinent source lines will + be escaped in a manner controlled by the user-supplied option + -fdiagnostics-escape-format=, so that the user can better understand + what's going on with the encoding in their source file. */ + bool escape_on_output_p () const { return m_escape_on_output; } + void set_escape_on_output (bool flag) { m_escape_on_output = flag; } + private: bool reject_impossible_fixit (location_t where); void stop_supporting_fixits (); @@ -1804,14 +1816,15 @@ protected: int m_column_override; bool m_have_expanded_location; + bool m_seen_impossible_fixit; + bool m_fixits_cannot_be_auto_applied; + bool m_escape_on_output; + expanded_location m_expanded_location; static const int MAX_STATIC_FIXIT_HINTS = 2; semi_embedded_vec <fixit_hint *, MAX_STATIC_FIXIT_HINTS> m_fixit_hints; - bool m_seen_impossible_fixit; - bool m_fixits_cannot_be_auto_applied; - const diagnostic_path *m_path; }; @@ -2093,8 +2106,8 @@ enum location_aspect /* 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. + implemented in gcc/input.cc, but we also need to use it for rich_location + within genmatch.cc. Hence we require client code of libcpp to implement the following symbol. */ extern expanded_location |