From 0e3e7e7c491cd88fddd734e844c8ef53d9ea0125 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Sat, 20 Jan 2018 11:09:51 -0500 Subject: [PATCH 32/35] 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 f290cb3..f370a2a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -15580,7 +15580,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: @@ -15643,8 +15643,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; } @@ -15667,7 +15667,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; @@ -15684,7 +15684,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) @@ -15694,7 +15694,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); @@ -15901,7 +15902,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)) @@ -16453,7 +16454,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); @@ -16464,6 +16467,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; @@ -16475,6 +16479,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)); @@ -16487,6 +16492,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, @@ -16500,6 +16506,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)); @@ -17829,6 +17836,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 @@ -17891,7 +17899,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: @@ -25959,6 +25967,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), @@ -25968,6 +25977,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