summaryrefslogtreecommitdiff
path: root/gcc/input.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-08-29 17:10:23 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-08-29 17:10:23 +0000
commit9144eabb893bf3cb4bad4c2447e8b56c5db7f577 (patch)
tree31d88147ce6530ac2c8a2b9c9137f481d64d072c /gcc/input.h
parent328eae1cb4cca4903f4b6de3bf56c4e59fdbdeae (diff)
make_location: ensure end-points are pure locations
gcc/ChangeLog: * input.c (make_location): Call get_start and get_finish on the endpoints to avoid storing packed ranges or ad-hoc ranges in them. (selftest::test_make_location_nonpure_range_endpoints): New function. (selftest::input_c_tests): Call it. * input.h (get_start): New inline function. From-SVN: r239831
Diffstat (limited to 'gcc/input.h')
-rw-r--r--gcc/input.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/input.h b/gcc/input.h
index c99abfd5292..ecf8db3a7ea 100644
--- a/gcc/input.h
+++ b/gcc/input.h
@@ -79,6 +79,14 @@ extern location_t input_location;
extern location_t get_pure_location (location_t loc);
+/* Get the start of any range encoded within location LOC. */
+
+static inline location_t
+get_start (location_t loc)
+{
+ return get_range_from_loc (line_table, loc).m_start;
+}
+
/* Get the endpoint of any range encoded within location LOC. */
static inline location_t