]> git.ipfire.org Git - thirdparty/gcc.git/commit
c,c++: use unique_ptr in name_hint to reduce naked 'new'
authorDavid Malcolm <dmalcolm@redhat.com>
Mon, 28 Apr 2025 22:21:19 +0000 (18:21 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Mon, 28 Apr 2025 22:21:19 +0000 (18:21 -0400)
commit9c4336cbf0522876ca3e81a2b5a71c8294441b81
treed6775bbdca25471482afc6e7a42c0b7493450406
parentbc39b0072f5660dd5dbacd551312be24281226ce
c,c++: use unique_ptr in name_hint to reduce naked 'new'

gcc/c-family/ChangeLog:
* name-hint.h (name_hint::name_hint): Use std::unique_ptr for
param.

gcc/c/ChangeLog:
* c-decl.cc: Include "make-unique.h".
(lookup_name_fuzzy): Use ::make_unique rather than "new" when
making suggest_missing_header and suggest_missing_option.
* c-parser.cc: Include "make-unique.h"
(c_parser_error_richloc): Use ::make_unique rather than "new" when
making suggest_missing_header.

gcc/cp/ChangeLog:
* name-lookup.cc: Include "make-unique.h".
(namespace_hints::convert_candidates_to_name_hint): Use
::make_unique rather than "new" when making
show_candidate_location and suggest_alternatives.
(namespace_hints::maybe_decorate_with_limit): Likewise when making
namespace_limit_reached.
(suggest_alternatives_for_1): Likewise when making
suggest_missing_option.
(maybe_suggest_missing_std_header): Likewise when making
missing_std_header.
(macro_use_before_def::maybe_make): Use std::unique_ptr.
(macro_use_before_def::macro_use_before_def): Make public.
(lookup_name_fuzzy): Use ::make_unique rather than "new" when
making suggest_missing_header.
* parser.cc: Include "make-unique.h".
(cp_parser_error_1): Use ::make_unique rather than "new" when
making suggest_missing_header.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/c-family/name-hint.h
gcc/c/c-decl.cc
gcc/c/c-parser.cc
gcc/cp/name-lookup.cc
gcc/cp/parser.cc