aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-01-16 14:55:12 -0500
committerJason Merrill <jason@gcc.gnu.org>2014-01-16 14:55:12 -0500
commitcfb1582ce3fd2524f32fb009c59e84dc999db4f9 (patch)
tree512300df630ee084b93066981e5a3d43ef3d5010 /gcc/cp/tree.c
parent42ed6cde4bd468d169ac198ef593aa4c686e7117 (diff)
downloadgcc-cfb1582ce3fd2524f32fb009c59e84dc999db4f9.zip
gcc-cfb1582ce3fd2524f32fb009c59e84dc999db4f9.tar.gz
gcc-cfb1582ce3fd2524f32fb009c59e84dc999db4f9.tar.bz2
re PR c++/59821 (__builtin_LINE and __builtin_FILE for new'd objects is wrong)
PR c++/59821 * tree.c (bot_manip): Update the location of builtin_LINE and builtin_FILE calls. From-SVN: r206686
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 7aad1eb..ce41c3b 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2306,7 +2306,20 @@ bot_manip (tree* tp, int* walk_subtrees, void* data)
/* Make a copy of this node. */
t = copy_tree_r (tp, walk_subtrees, NULL);
if (TREE_CODE (*tp) == CALL_EXPR)
- set_flags_from_callee (*tp);
+ {
+ set_flags_from_callee (*tp);
+
+ /* builtin_LINE and builtin_FILE get the location where the default
+ argument is expanded, not where the call was written. */
+ tree callee = get_callee_fndecl (*tp);
+ if (callee && DECL_BUILT_IN (callee))
+ switch (DECL_FUNCTION_CODE (callee))
+ {
+ case BUILT_IN_FILE:
+ case BUILT_IN_LINE:
+ SET_EXPR_LOCATION (*tp, input_location);
+ }
+ }
return t;
}