aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index bd5cf73..c8b3ab8 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -13905,7 +13905,7 @@ nonnull_arg_p (const_tree arg)
/* Given location LOC, strip away any packed range information
or ad-hoc information. */
-static location_t
+location_t
get_pure_location (location_t loc)
{
if (IS_ADHOC_LOC (loc))
@@ -13935,20 +13935,20 @@ set_block (location_t loc, tree block)
return COMBINE_LOCATION_DATA (line_table, pure_loc, src_range, block);
}
-void
+location_t
set_source_range (tree expr, location_t start, location_t finish)
{
source_range src_range;
src_range.m_start = start;
src_range.m_finish = finish;
- set_source_range (expr, src_range);
+ return set_source_range (expr, src_range);
}
-void
+location_t
set_source_range (tree expr, source_range src_range)
{
if (!EXPR_P (expr))
- return;
+ return UNKNOWN_LOCATION;
location_t pure_loc = get_pure_location (EXPR_LOCATION (expr));
location_t adhoc = COMBINE_LOCATION_DATA (line_table,
@@ -13956,6 +13956,21 @@ set_source_range (tree expr, source_range src_range)
src_range,
NULL);
SET_EXPR_LOCATION (expr, adhoc);
+ return adhoc;
+}
+
+location_t
+make_location (location_t caret, location_t start, location_t finish)
+{
+ location_t pure_loc = get_pure_location (caret);
+ source_range src_range;
+ src_range.m_start = start;
+ src_range.m_finish = finish;
+ location_t combined_loc = COMBINE_LOCATION_DATA (line_table,
+ pure_loc,
+ src_range,
+ NULL);
+ return combined_loc;
}
/* Return the name of combined function FN, for debugging purposes. */