From f03f764ab8f6ee2779e1e2b28af62dd161717151 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Sat, 20 Jan 2018 11:09:51 -0500 Subject: [PATCH 14/17] FIXME: WIP on preserving locations in pt.c --- gcc/cp/pt.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index bce0abe..26a4828 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -15581,7 +15581,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) { tree type = tsubst (TREE_TYPE (t), args, complain, in_decl); tree op0 = tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl); - return build1 (code, type, op0); + return build1_loc (EXPR_LOCATION (t), code, type, op0); } case SIZEOF_EXPR: @@ -15644,8 +15644,8 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) r = tsubst (TREE_TYPE (TREE_OPERAND (t, 0)), args, complain, in_decl); r = build1 (NOP_EXPR, r, error_mark_node); - r = build1 (SIZEOF_EXPR, - tsubst (TREE_TYPE (t), args, complain, in_decl), r); + r = build1_loc (EXPR_LOCATION (t), SIZEOF_EXPR, + tsubst (TREE_TYPE (t), args, complain, in_decl), r); SIZEOF_EXPR_TYPE_P (r) = 1; return r; } @@ -15668,7 +15668,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) { tree type = tsubst (TREE_TYPE (t), args, complain, in_decl); tree op0 = tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl); - r = build1 (code, type, op0); + r = build1_loc (EXPR_LOCATION (t), code, type, op0); if (code == ALIGNOF_EXPR) ALIGNOF_EXPR_STD_P (r) = ALIGNOF_EXPR_STD_P (t); return r; @@ -15685,7 +15685,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) { name = tsubst_copy (TREE_OPERAND (name, 0), args, complain, in_decl); - name = build1 (BIT_NOT_EXPR, NULL_TREE, name); + name = build1_loc (EXPR_LOCATION (t), BIT_NOT_EXPR, NULL_TREE, name); } else if (TREE_CODE (name) == SCOPE_REF && TREE_CODE (TREE_OPERAND (name, 1)) == BIT_NOT_EXPR) @@ -15695,7 +15695,8 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) name = TREE_OPERAND (name, 1); name = tsubst_copy (TREE_OPERAND (name, 0), args, complain, in_decl); - name = build1 (BIT_NOT_EXPR, NULL_TREE, name); + name = build1_loc (EXPR_LOCATION (t), BIT_NOT_EXPR, NULL_TREE, + name); name = build_qualified_name (/*type=*/NULL_TREE, base, name, /*template_p=*/false); @@ -15902,7 +15903,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) tree type = tsubst (TREE_TYPE (t), args, complain, in_decl); tree op0 = tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl); tree op1 = tsubst_copy (TREE_OPERAND (t, 1), args, complain, in_decl); - r = build2 (code, type, op0, op1); + r = build2_loc (EXPR_LOCATION (t), code, type, op0, op1); PTRMEM_OK_P (r) = PTRMEM_OK_P (t); if (!mark_used (TREE_OPERAND (r, 1), complain) && !(complain & tf_error)) @@ -16454,7 +16455,9 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree orig_declv, { tree op0 = RECUR (TREE_OPERAND (cond, 0)); tree op1 = RECUR (TREE_OPERAND (cond, 1)); - cond = build2 (TREE_CODE (cond), boolean_type_node, op0, op1); + cond = build2_loc (EXPR_LOCATION (cond), TREE_CODE (cond), + boolean_type_node, op0, op1); + //#error got here } else cond = RECUR (cond); @@ -16465,6 +16468,7 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree orig_declv, case PREDECREMENT_EXPR: case POSTINCREMENT_EXPR: case POSTDECREMENT_EXPR: + // FIXME incr = build2 (TREE_CODE (incr), TREE_TYPE (decl), RECUR (TREE_OPERAND (incr, 0)), NULL_TREE); break; @@ -16476,6 +16480,7 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree orig_declv, tree lhs = RECUR (TREE_OPERAND (incr, 0)); tree rhs0 = RECUR (TREE_OPERAND (rhs, 0)); tree rhs1 = RECUR (TREE_OPERAND (rhs, 1)); + // FIXME incr = build2 (MODIFY_EXPR, TREE_TYPE (decl), lhs, build2 (TREE_CODE (rhs), TREE_TYPE (decl), rhs0, rhs1)); @@ -16488,6 +16493,7 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree orig_declv, || TREE_CODE (TREE_OPERAND (incr, 1)) == MINUS_EXPR) { tree lhs = RECUR (TREE_OPERAND (incr, 0)); + // FIXME incr = build2 (MODIFY_EXPR, TREE_TYPE (decl), lhs, build2 (TREE_CODE (TREE_OPERAND (incr, 1)), TREE_TYPE (decl), lhs, @@ -16501,6 +16507,7 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree orig_declv, tree lhs = RECUR (TREE_OPERAND (incr, 0)); tree rhs0 = RECUR (TREE_OPERAND (rhs, 0)); tree rhs1 = RECUR (TREE_OPERAND (rhs, 1)); + // FIXME incr = build2 (MODIFY_EXPR, TREE_TYPE (decl), lhs, build2 (TREE_CODE (rhs), TREE_TYPE (decl), rhs0, rhs1)); @@ -17830,6 +17837,7 @@ tsubst_copy_and_build (tree t, templ = lookup_template_function (templ, targs); if (object) + // FIXME RETURN (build3 (COMPONENT_REF, TREE_TYPE (templ), object, templ, NULL_TREE)); else @@ -17892,7 +17900,7 @@ tsubst_copy_and_build (tree t, tree op0 = RECUR (TREE_OPERAND (t, 0)); if (op0 == error_mark_node) RETURN (error_mark_node); - RETURN (build1 (CONVERT_EXPR, type, op0)); + RETURN (build1_loc (EXPR_LOCATION (t), CONVERT_EXPR, type, op0)); } case CAST_EXPR: @@ -25960,6 +25968,7 @@ build_non_dependent_expr (tree expr) return orig_expr; if (TREE_CODE (expr) == COND_EXPR) + // FIXME return build3 (COND_EXPR, TREE_TYPE (expr), TREE_OPERAND (expr, 0), @@ -25969,6 +25978,7 @@ build_non_dependent_expr (tree expr) build_non_dependent_expr (TREE_OPERAND (expr, 2))); if (TREE_CODE (expr) == COMPOUND_EXPR && !COMPOUND_EXPR_OVERLOADED (expr)) + // FIXME return build2 (COMPOUND_EXPR, TREE_TYPE (expr), TREE_OPERAND (expr, 0), -- 1.8.5.3