Preserving locations for variable-uses and constants (PR c++/43486)
[official-gcc.git] / gcc / cp / ChangeLog
blobd24c9343620a668275bde875640863479e025257
1 2018-01-10  David Malcolm  <dmalcolm@redhat.com>
3         PR c++/43486
4         * call.c (null_ptr_cst_p): Strip location wrappers when
5         converting from '0' to a pointer type in C++11 onwards.
6         (conversion_null_warnings): Replace comparison with null_node with
7         call to null_node_p.
8         (build_over_call): Likewise.
9         * cp-gimplify.c (cp_fold): Remove the early bailout when
10         processing_template_decl.
11         * cp-lang.c (selftest::run_cp_tests): Call
12         selftest::cp_pt_c_tests and selftest::cp_tree_c_tests.
13         * cp-tree.h (cp_expr::maybe_add_location_wrapper): New method.
14         (selftest::run_cp_tests): Move decl to bottom of file.
15         (null_node_p): New inline function.
16         (selftest::cp_pt_c_tests): New decl.
17         (selftest::cp_tree_c_tests): New decl.
18         * cvt.c (build_expr_type_conversion): Replace comparison with
19         null_node with call to null_node_p.
20         * error.c (args_to_string): Likewise.
21         * except.c (build_throw): Likewise.
22         * mangle.c (write_expression): Skip location wrapper nodes.
23         * parser.c (literal_integer_zerop): New function.
24         (cp_parser_postfix_expression): Call maybe_add_location_wrapper on
25         the result for RID_TYPEID. Pass true for new "wrap_locations_p"
26         param of cp_parser_parenthesized_expression_list.  When calling
27         warn_for_memset, replace integer_zerop calls with
28         literal_integer_zerop, eliminating the double logical negation
29         cast to bool.  Eliminate the special-casing for CONST_DECL in
30         favor of the fold_for_warn within warn_for_memset.
31         (cp_parser_parenthesized_expression_list): Add "wrap_locations_p"
32         param, defaulting to false.  Convert "expr" to a cp_expr, and call
33         maybe_add_location_wrapper on it when wrap_locations_p is true.
34         (cp_parser_unary_expression): Call maybe_add_location_wrapper on
35         the result for RID_ALIGNOF and RID_SIZEOF.
36         (cp_parser_builtin_offsetof): Likewise.
37         * pt.c: Include "selftest.h".
38         (tsubst_copy): Handle location wrappers.
39         (tsubst_copy_and_build): Likewise.
40         (build_non_dependent_expr): Likewise.
41         (selftest::test_build_non_dependent_expr): New function.
42         (selftest::cp_pt_c_tests): New function.
43         * tree.c: Include "selftest.h".
44         (lvalue_kind): Handle VIEW_CONVERT_EXPR location wrapper nodes.
45         (selftest::test_lvalue_kind): New function.
46         (selftest::cp_tree_c_tests): New function.
47         * typeck.c (string_conv_p): Strip any location wrapper from "exp".
48         (cp_build_binary_op): Replace comparison with null_node with call
49         to null_node_p.
50         (build_address): Use location of operand when building address
51         expression.
53 2018-01-10  Marek Polacek  <polacek@redhat.com>
55         PR c++/82541
56         * call.c (build_conditional_expr_1): Check complain before warning.
57         * pt.c (tsubst_copy_and_build) <case COND_EXPR>: Suppress
58         -Wduplicated-branches.
60 2018-01-10  Jakub Jelinek  <jakub@redhat.com>
62         PR c++/81327
63         * call.c (maybe_warn_class_memaccess): Add forward declaration.
64         Change last argument from tree * to const vec<tree, va_gc> *, adjust
65         args uses and check number of operands too.  Don't strip away any
66         nops.  Use maybe_constant_value when looking for INTEGER_CST args.
67         Deal with src argument not having pointer type.  Check
68         tree_fits_uhwi_p before calling tree_to_uhwi.  Remove useless
69         test.
70         (build_over_call): Call maybe_warn_class_memaccess here on the
71         original arguments.
72         (build_cxx_call): Rather than here on converted arguments.
74 2018-01-10  Paolo Carlini  <paolo.carlini@oracle.com>
76         PR c++/81055
77         * init.c (build_vec_init): Avoid building an INIT_EXPR with
78         error_mark_node as second argument.
80 2018-01-09  Jakub Jelinek  <jakub@redhat.com>
82         PR c++/83734
83         * constexpr.c (cxx_eval_statement_list): Ignore DEBUG_BEGIN_STMTs
84         in STATEMENT_LIST.  Remove unneeded assert.
86 2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
87             Alan Hayward  <alan.hayward@arm.com>
88             David Sherwood  <david.sherwood@arm.com>
90         * constexpr.c (cxx_eval_array_reference): Handle polynomial
91         VECTOR_CST_NELTS.
92         (cxx_fold_indirect_ref): Handle polynomial TYPE_VECTOR_SUBPARTS.
93         * call.c (build_conditional_expr_1): Likewise.
94         * decl.c (cp_finish_decomp): Likewise.
95         * mangle.c (write_type): Likewise.
96         * typeck.c (structural_comptypes): Likewise.
97         (cp_build_binary_op): Likewise.
98         * typeck2.c (process_init_constructor_array): Likewise.
100 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
102         PR c++/83555
103         * typeck.c (build_static_cast_1): For static casts to reference types,
104         call build_base_path with flag_delete_null_pointer_checks as nonnull
105         instead of always false.  When -fsanitize=null, call
106         ubsan_maybe_instrument_reference on the NULL reference INTEGER_CST.
107         * cp-gimplify.c (cp_genericize_r): Don't walk subtrees of UBSAN_NULL
108         call if the first argument is INTEGER_CST with REFERENCE_TYPE.
110 2018-01-03  Nathan Sidwell  <nathan@acm.org>
112         PR c++/83667
113         * method.c (make_alias_for): Copy DECL_CONTEXT.
115 2018-01-03  Marek Polacek  <polacek@redhat.com>
117         PR c++/83592
118         * decl.c (grokdeclarator): Don't warn about MVP in typename context.
120 2018-01-03  Jakub Jelinek  <jakub@redhat.com>
122         PR preprocessor/83602
123         * name-lookup.c (lookup_name_fuzzy): Don't use macro_use_before_def
124         for builtin macros.
126         PR c++/83634
127         * cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
128         error_mark_node, return error_mark_node.
130         Update copyright years.
132 2018-01-02  Jakub Jelinek  <jakub@redhat.com>
134         PR c++/83556
135         * tree.c (replace_placeholders_r): Pass NULL as last argument to
136         cp_walk_tree instead of d->pset.  If non-TREE_CONSTANT and
137         non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
138         to false and return.
139         (replace_placeholders): Pass NULL instead of &pset as last argument
140         to cp_walk_tree.
142 2018-01-02  Nathan Sidwell  <nathan@acm.org>
144         * constexpr.c (cxx_bind_parameters_in_call): Remove unneeded local
145         lval var.
147 Copyright (C) 2018 Free Software Foundation, Inc.
149 Copying and distribution of this file, with or without modification,
150 are permitted in any medium without royalty provided the copyright
151 notice and this notice are preserved.