summaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/errors.cc10
-rw-r--r--libcpp/include/cpplib.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/libcpp/errors.cc b/libcpp/errors.cc
index 9621c4b66ea..d9efb6acd30 100644
--- a/libcpp/errors.cc
+++ b/libcpp/errors.cc
@@ -52,6 +52,16 @@ cpp_diagnostic_get_current_location (cpp_reader *pfile)
}
}
+/* Sometimes a diagnostic needs to be generated before libcpp has been able
+ to generate a valid location for the current token; in that case, the
+ non-zero location returned by this function is the preferred one to use. */
+
+location_t
+cpp_get_diagnostic_override_loc (const cpp_reader *pfile)
+{
+ return pfile->diagnostic_override_loc;
+}
+
/* Print a diagnostic at the given location. */
ATTRIBUTE_CPP_PPDIAG (5, 0)
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 3bf33ab4884..7c147ae5847 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -1169,6 +1169,8 @@ extern const char *cpp_probe_header_unit (cpp_reader *, const char *file,
extern const char *cpp_get_narrow_charset_name (cpp_reader *) ATTRIBUTE_PURE;
extern const char *cpp_get_wide_charset_name (cpp_reader *) ATTRIBUTE_PURE;
+extern location_t cpp_get_diagnostic_override_loc (const cpp_reader *);
+
/* This function reads the file, but does not start preprocessing. It
returns the name of the original file; this is the same as the
input file, except for preprocessed input. This will generate at