diff options
| author | Paul Brook <paul@codesourcery.com> | 2004-08-04 15:33:51 +0000 |
|---|---|---|
| committer | Paul Brook <pbrook@gcc.gnu.org> | 2004-08-04 15:33:51 +0000 |
| commit | 44d10c10029bc5bec8fb352c6270b07f0d4d82e8 (patch) | |
| tree | c6669d1a536c5ee91ed55f661a6f7a5a2bd88e47 /gcc/cp/method.c | |
| parent | 20c176ab4b4e79436d7229f91cdda768bab64241 (diff) | |
| download | gcc-44d10c10029bc5bec8fb352c6270b07f0d4d82e8.zip gcc-44d10c10029bc5bec8fb352c6270b07f0d4d82e8.tar.gz gcc-44d10c10029bc5bec8fb352c6270b07f0d4d82e8.tar.bz2 | |
target-def.h (TARGET_CXX_CDTOR_RETURNS_THIS): Define.
gcc/
* target-def.h (TARGET_CXX_CDTOR_RETURNS_THIS): Define.
(TARGET_CXX): Use it.
* target.h (struct gcc_target): Add cdtor_returns_this.
* config/arm/arm.c (arm_cxx_cdtor_returns_this): New function.
(TARGET_CXX_CDTOR_RETURNS_THIS): Define.
* doc/tm.texi: Document TARGET_CXX_CDTOR_RETURNS_THIS.
gcc/cp/
* Make-lang.in (cp/semantics.o, cp/optimize.o): Depend on TARGET_H.
* cp-tree.h (struct language_function): Rename x_dtor_label to
x_cdtor_label.
(dtor_label): Rename ...
(cdtor_label): ... to this.
* decl.c (begin_constructor_body): Remove.
(check_special_function_return_type): Maybe change the return type.
(grokdeclarator): Pass the class type.
(start_preparsed_function): Constructors may need a return label.
(finish_constructor_body, finish_destructor_body): Set the return
value.
(begin_function_body): Don't call begin_constructor_body.
(finish_function): Don't warn for constructors or destructors.
(implicitly_declare_fn): Maybe change the return type.
* optimize.c: Include target.h.
(maybe_clone_body): Remap the function result.
* semantics.c: Include target.h.
(finish_return_stmt): Maybe jump to return label for constructors.
From-SVN: r85561
Diffstat (limited to 'gcc/cp/method.c')
| -rw-r--r-- | gcc/cp/method.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 7a2a762..317790e 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -929,7 +929,7 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p) { tree fn; tree parameter_types = void_list_node; - tree return_type = void_type_node; + tree return_type; tree fn_type; tree raises = empty_except_spec; tree rhs_parm_type = NULL_TREE; @@ -937,6 +937,17 @@ implicitly_declare_fn (special_function_kind kind, tree type, bool const_p) type = TYPE_MAIN_VARIANT (type); + if (targetm.cxx.cdtor_returns_this () && !TYPE_FOR_JAVA (type)) + { + if (kind == sfk_destructor) + /* See comment in check_special_function_return_type. */ + return_type = build_pointer_type (void_type_node); + else + return_type = build_pointer_type (type); + } + else + return_type = void_type_node; + switch (kind) { case sfk_destructor: |
