diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-05-21 07:00:45 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-05-21 07:00:45 +0000 |
commit | 419ba5b941e67a85b7085fee91a20e4a93887af6 (patch) | |
tree | d30a1288d57e6cdbaf961ba63a2c17cd50d768d2 /gcc | |
parent | eaa6a39d4288fef9c322e8fe6c45e621b22cdf3f (diff) | |
download | gcc-419ba5b941e67a85b7085fee91a20e4a93887af6.zip gcc-419ba5b941e67a85b7085fee91a20e4a93887af6.tar.gz gcc-419ba5b941e67a85b7085fee91a20e4a93887af6.tar.bz2 |
c-ada-spec.h (enum cpp_operation): Add IS_ASSIGNMENT_OPERATOR.
c-family/
* c-ada-spec.h (enum cpp_operation): Add IS_ASSIGNMENT_OPERATOR.
* c-ada-spec.c (print_assignment_operator): New function.
(dump_ada_declaration) <FUNCTION_DECL>: Call it do dump explicit copy
assignment operators declared as methods and filter out the others.
cp/
* decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case.
From-SVN: r271457
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/c-family/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-family/c-ada-spec.c | 22 | ||||
-rw-r--r-- | gcc/c-family/c-ada-spec.h | 1 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 2 |
6 files changed, 38 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ccea2b9..e2a75de 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,7 +1,7 @@ 2019-05-16 Martin Sebor <msebor@redhat.com> - * gcc-interface/trans.c (check_inlining_for_nested_subprog): Quote - reserved names. + * gcc-interface/trans.c (check_inlining_for_nested_subprog): Quote + reserved names. 2019-05-08 Arnaud Charlet <charlet@adacore.com> diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 5068776..71cb361 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2019-05-21 Eric Botcazou <ebotcazou@adacore.com> + + * c-ada-spec.h (enum cpp_operation): Add IS_ASSIGNMENT_OPERATOR. + * c-ada-spec.c (print_assignment_operator): New function. + (dump_ada_declaration) <FUNCTION_DECL>: Call it do dump explicit copy + assignment operators declared as methods and filter out the others. + 2019-05-17 Thomas Schwinge <thomas@codesourcery.com> PR c/89433 diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index c85e606..dc3a044 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -2681,6 +2681,17 @@ print_destructor (pretty_printer *buffer, tree t, tree type) pp_ada_tree_identifier (buffer, decl_name, t, false); } +/* Dump in BUFFER assignment operator spec corresponding to T. */ + +static void +print_assignment_operator (pretty_printer *buffer, tree t, tree type) +{ + tree decl_name = DECL_NAME (TYPE_NAME (type)); + + pp_string (buffer, "Assign_"); + pp_ada_tree_identifier (buffer, decl_name, t, false); +} + /* Return the name of type T. */ static const char * @@ -2920,6 +2931,7 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) bool is_method = TREE_CODE (TREE_TYPE (t)) == METHOD_TYPE; tree decl_name = DECL_NAME (t); bool is_abstract = false; + bool is_assignment_operator = false; bool is_constructor = false; bool is_destructor = false; bool is_copy_constructor = false; @@ -2931,6 +2943,7 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) if (cpp_check) { is_abstract = cpp_check (t, IS_ABSTRACT); + is_assignment_operator = cpp_check (t, IS_ASSIGNMENT_OPERATOR); is_constructor = cpp_check (t, IS_CONSTRUCTOR); is_destructor = cpp_check (t, IS_DESTRUCTOR); is_copy_constructor = cpp_check (t, IS_COPY_CONSTRUCTOR); @@ -2955,6 +2968,13 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) return 0; } + else if (is_assignment_operator) + { + /* ??? Skip implicit or non-method assignment operators for now. */ + if (DECL_ARTIFICIAL (t) || !is_method) + return 0; + } + /* If this function has an entry in the vtable, we cannot omit it. */ else if (!DECL_VINDEX (t) && *IDENTIFIER_POINTER (decl_name) == '_') { @@ -2977,6 +2997,8 @@ dump_ada_declaration (pretty_printer *buffer, tree t, tree type, int spc) print_constructor (buffer, t, type); else if (is_destructor) print_destructor (buffer, t, type); + else if (is_assignment_operator) + print_assignment_operator (buffer, t, type); else dump_ada_decl_name (buffer, t, false); diff --git a/gcc/c-family/c-ada-spec.h b/gcc/c-family/c-ada-spec.h index 5993662..f9ea1bc 100644 --- a/gcc/c-family/c-ada-spec.h +++ b/gcc/c-family/c-ada-spec.h @@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see enum cpp_operation { HAS_DEPENDENT_TEMPLATE_ARGS, IS_ABSTRACT, + IS_ASSIGNMENT_OPERATOR, IS_CONSTRUCTOR, IS_DESTRUCTOR, IS_COPY_CONSTRUCTOR, diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f5f6c44..f895f13 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2019-05-21 Eric Botcazou <ebotcazou@adacore.com> + + * decl2.c (cpp_check) <IS_ASSIGNMENT_OPERATOR>: New case. + 2019-05-20 Marek Polacek <polacek@redhat.com> CWG 2094 - volatile scalars are trivially copyable. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index bd022ca..338db4a 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4249,6 +4249,8 @@ cpp_check (tree t, cpp_operation op) } case IS_ABSTRACT: return DECL_PURE_VIRTUAL_P (t); + case IS_ASSIGNMENT_OPERATOR: + return DECL_ASSIGNMENT_OPERATOR_P (t); case IS_CONSTRUCTOR: return DECL_CONSTRUCTOR_P (t); case IS_DESTRUCTOR: |