aboutsummaryrefslogtreecommitdiff
path: root/libcpp/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp/internal.h')
-rw-r--r--libcpp/internal.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/libcpp/internal.h b/libcpp/internal.h
index fd44de6..8577cab 100644
--- a/libcpp/internal.h
+++ b/libcpp/internal.h
@@ -769,6 +769,9 @@ extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *,
extern void _cpp_pop_buffer (cpp_reader *);
extern char *_cpp_bracket_include (cpp_reader *);
+/* In errors.c */
+extern location_t cpp_diagnostic_get_current_location (cpp_reader *);
+
/* In traditional.c. */
extern bool _cpp_scan_out_logical_line (cpp_reader *, cpp_macro *, bool);
extern bool _cpp_read_logical_line_trad (cpp_reader *);
@@ -935,6 +938,26 @@ int linemap_get_expansion_line (class line_maps *,
const char* linemap_get_expansion_filename (class line_maps *,
location_t);
+/* A subclass of rich_location for emitting a diagnostic
+ at the current location of the reader, but flagging
+ it with set_escape_on_output (true). */
+class encoding_rich_location : public rich_location
+{
+ public:
+ encoding_rich_location (cpp_reader *pfile)
+ : rich_location (pfile->line_table,
+ cpp_diagnostic_get_current_location (pfile))
+ {
+ set_escape_on_output (true);
+ }
+
+ encoding_rich_location (cpp_reader *pfile, location_t loc)
+ : rich_location (pfile->line_table, loc)
+ {
+ set_escape_on_output (true);
+ }
+};
+
#ifdef __cplusplus
}
#endif