diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-08-29 17:10:23 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-08-29 17:10:23 +0000 |
commit | 9144eabb893bf3cb4bad4c2447e8b56c5db7f577 (patch) | |
tree | 31d88147ce6530ac2c8a2b9c9137f481d64d072c /gcc/input.h | |
parent | 328eae1cb4cca4903f4b6de3bf56c4e59fdbdeae (diff) | |
download | gcc-9144eabb893bf3cb4bad4c2447e8b56c5db7f577.zip gcc-9144eabb893bf3cb4bad4c2447e8b56c5db7f577.tar.gz gcc-9144eabb893bf3cb4bad4c2447e8b56c5db7f577.tar.bz2 |
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.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/input.h b/gcc/input.h index c99abfd..ecf8db3 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 |