annotate gcc/objcp/objcp-lang.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Language-dependent hooks for Objective-C++.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 Copyright (C) 2005-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3 Contributed by Ziemowit Laski <zlaski@apple.com>
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 This file is part of GCC.
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
9 the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
10 any later version.
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
15 GNU General Public License for more details.
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 #include "config.h"
kono
parents:
diff changeset
22 #include "system.h"
kono
parents:
diff changeset
23 #include "coretypes.h"
kono
parents:
diff changeset
24 #include "cp-tree.h"
kono
parents:
diff changeset
25 #include "c-family/c-objc.h"
kono
parents:
diff changeset
26 #include "objc-act.h"
kono
parents:
diff changeset
27 #include "langhooks.h"
kono
parents:
diff changeset
28 #include "langhooks-def.h"
kono
parents:
diff changeset
29 #include "cp-objcp-common.h"
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 enum c_language_kind c_language = clk_objcxx;
kono
parents:
diff changeset
32 static void objcxx_init_ts (void);
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 /* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h;
kono
parents:
diff changeset
35 consequently, there should be very few hooks below. */
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 #undef LANG_HOOKS_NAME
kono
parents:
diff changeset
38 #define LANG_HOOKS_NAME "GNU Objective-C++"
kono
parents:
diff changeset
39 #undef LANG_HOOKS_INIT
kono
parents:
diff changeset
40 #define LANG_HOOKS_INIT objc_init
kono
parents:
diff changeset
41 #undef LANG_HOOKS_GIMPLIFY_EXPR
kono
parents:
diff changeset
42 #define LANG_HOOKS_GIMPLIFY_EXPR objc_gimplify_expr
kono
parents:
diff changeset
43 #undef LANG_HOOKS_INIT_TS
kono
parents:
diff changeset
44 #define LANG_HOOKS_INIT_TS objcxx_init_ts
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 /* Each front end provides its own lang hook initializer. */
kono
parents:
diff changeset
47 struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 /* Lang hook routines common to C++ and ObjC++ appear in cp/cp-objcp-common.c;
kono
parents:
diff changeset
50 there should be very few (if any) routines below. */
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 tree
kono
parents:
diff changeset
53 objcp_tsubst_copy_and_build (tree t, tree args, tsubst_flags_t complain,
kono
parents:
diff changeset
54 tree in_decl, bool function_p ATTRIBUTE_UNUSED)
kono
parents:
diff changeset
55 {
kono
parents:
diff changeset
56 #define RECURSE(NODE) \
kono
parents:
diff changeset
57 tsubst_copy_and_build (NODE, args, complain, in_decl, \
kono
parents:
diff changeset
58 /*function_p=*/false, \
kono
parents:
diff changeset
59 /*integral_constant_expression_p=*/false)
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 /* The following two can only occur in Objective-C++. */
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 switch ((int) TREE_CODE (t))
kono
parents:
diff changeset
64 {
kono
parents:
diff changeset
65 case MESSAGE_SEND_EXPR:
kono
parents:
diff changeset
66 return objc_finish_message_expr
kono
parents:
diff changeset
67 (RECURSE (TREE_OPERAND (t, 0)),
kono
parents:
diff changeset
68 TREE_OPERAND (t, 1), /* No need to expand the selector. */
kono
parents:
diff changeset
69 RECURSE (TREE_OPERAND (t, 2)), NULL);
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 case CLASS_REFERENCE_EXPR:
kono
parents:
diff changeset
72 return objc_get_class_reference
kono
parents:
diff changeset
73 (RECURSE (TREE_OPERAND (t, 0)));
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 default:
kono
parents:
diff changeset
76 break;
kono
parents:
diff changeset
77 }
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 /* Fall back to C++ processing. */
kono
parents:
diff changeset
80 return NULL_TREE;
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 #undef RECURSE
kono
parents:
diff changeset
83 }
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 static void
kono
parents:
diff changeset
86 objcxx_init_ts (void)
kono
parents:
diff changeset
87 {
kono
parents:
diff changeset
88 objc_common_init_ts ();
kono
parents:
diff changeset
89 cp_common_init_ts ();
kono
parents:
diff changeset
90 }
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 #include "gtype-objcp.h"