summaryrefslogtreecommitdiff
path: root/gcc/gcc-rich-location.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gcc-rich-location.c')
-rw-r--r--gcc/gcc-rich-location.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/gcc/gcc-rich-location.c b/gcc/gcc-rich-location.c
index 9ab4314a875..a03ce0ee5fa 100644
--- a/gcc/gcc-rich-location.c
+++ b/gcc/gcc-rich-location.c
@@ -41,28 +41,6 @@ along with GCC; see the file COPYING3. If not see
#include "cpplib.h"
#include "diagnostic.h"
-/* Extract any source range information from EXPR and write it
- to *R. */
-
-static bool
-get_range_for_expr (tree expr, location_range *r)
-{
- if (EXPR_HAS_RANGE (expr))
- {
- source_range sr = EXPR_LOCATION_RANGE (expr);
-
- /* Do we have meaningful data? */
- if (sr.m_start && sr.m_finish)
- {
- r->m_start = expand_location (sr.m_start);
- r->m_finish = expand_location (sr.m_finish);
- return true;
- }
- }
-
- return false;
-}
-
/* Add a range to the rich_location, covering expression EXPR. */
void
@@ -70,10 +48,8 @@ gcc_rich_location::add_expr (tree expr)
{
gcc_assert (expr);
- location_range r;
- r.m_show_caret_p = false;
- if (get_range_for_expr (expr, &r))
- add_range (&r);
+ if (CAN_HAVE_RANGE_P (expr))
+ add_range (EXPR_LOCATION (expr), false);
}
/* If T is an expression, add a range for it to the rich_location. */