summaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-08-31 18:09:47 -0400
committerJason Merrill <jason@gcc.gnu.org>2019-08-31 18:09:47 -0400
commitad527d801855d7992e25b1548628566eefcf69e9 (patch)
tree86c87662ff59d345f1508373a2a5b3ceaddf3f1a /gcc/cp/semantics.c
parentbd486c8cdfd943289c8c729f2dc6e0ef911bdb28 (diff)
downloadgcc-ad527d801855d7992e25b1548628566eefcf69e9.tar.gz
Add source location to TRAIT_EXPR.
Since TRAIT_EXPR is exceptional, maybe_wrap_with_location won't wrap it, so we need to put its location in the TRAIT_EXPR node itself. * cp-tree.h (TRAIT_EXPR_LOCATION): New. (struct tree_trait_expr): Add locus field. * parser.c (cp_parser_trait_expr): Pass trait_loc down. * pt.c (tsubst_copy_and_build) [TRAIT_EXPR]: Likewise. * semantics.c (finish_trait_expr): Add location parm. * tree.c (cp_expr_location): Handle TRAIT_EXPR. From-SVN: r275260
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r--gcc/cp/semantics.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index b61d86f94b9..56f70a0a589 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -9921,7 +9921,7 @@ check_trait_type (tree type)
/* Process a trait expression. */
tree
-finish_trait_expr (cp_trait_kind kind, tree type1, tree type2)
+finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
{
if (type1 == error_mark_node
|| type2 == error_mark_node)
@@ -9934,6 +9934,7 @@ finish_trait_expr (cp_trait_kind kind, tree type1, tree type2)
TRAIT_EXPR_TYPE1 (trait_expr) = type1;
TRAIT_EXPR_TYPE2 (trait_expr) = type2;
TRAIT_EXPR_KIND (trait_expr) = kind;
+ TRAIT_EXPR_LOCATION (trait_expr) = loc;
return trait_expr;
}
@@ -9991,8 +9992,9 @@ finish_trait_expr (cp_trait_kind kind, tree type1, tree type2)
gcc_unreachable ();
}
- return (trait_expr_value (kind, type1, type2)
- ? boolean_true_node : boolean_false_node);
+tree val = (trait_expr_value (kind, type1, type2)
+ ? boolean_true_node : boolean_false_node);
+ return maybe_wrap_with_location (val, loc);
}
/* Do-nothing variants of functions to handle pragma FLOAT_CONST_DECIMAL64,