1 /* Process the ObjC-specific declarations and variables for
2 the Objective-C++ compiler.
3 Copyright (C) 2005 Free Software Foundation, Inc.
4 Contributed by Ziemowit Laski <zlaski@apple.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the Free
20 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
23 #ifndef GCC_OBJCP_DECL_H
24 #define GCC_OBJCP_DECL_H
26 extern tree
objcp_start_struct (enum tree_code
, tree
);
27 extern tree
objcp_finish_struct (tree
, tree
, tree
);
28 extern void objcp_finish_function (void);
29 extern tree
objcp_lookup_name (tree
);
30 extern tree
objcp_build_function_call (tree
, tree
);
31 extern tree
objcp_xref_tag (enum tree_code
, tree
);
32 extern int objcp_comptypes (tree
, tree
);
33 extern tree
objcp_builtin_function (const char *, tree
, int,
34 enum built_in_class
, const char *, tree
);
35 extern tree
objcp_begin_compound_stmt (int);
36 extern tree
objcp_end_compound_stmt (tree
, int);
38 /* Now "cover up" the corresponding C++ functions if required (NB: the
39 OBJCP_ORIGINAL_FUNCTION macro, shown below, can still be used to
40 invoke the original C++ functions if needed). */
41 #ifdef OBJCP_REMAP_FUNCTIONS
43 #define start_struct(code, name) \
44 objcp_start_struct (code, name)
45 #define finish_struct(t, fieldlist, attributes) \
46 objcp_finish_struct (t, fieldlist, attributes)
47 #define finish_function() \
48 objcp_finish_function ()
49 #define lookup_name(name) \
50 objcp_lookup_name (name)
51 #define xref_tag(code, name) \
52 objcp_xref_tag (code, name)
53 #define comptypes(type1, type2) \
54 objcp_comptypes (type1, type2)
55 #define c_begin_compound_stmt(flags) \
56 objcp_begin_compound_stmt (flags)
57 #define c_end_compound_stmt(stmt, flags) \
58 objcp_end_compound_stmt (stmt, flags)
61 #define OBJC_TYPE_NAME(type) \
62 (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL \
63 ? DECL_NAME (TYPE_NAME (type)) \
65 #undef OBJC_SET_TYPE_NAME
66 #define OBJC_SET_TYPE_NAME(type, name) \
67 if(TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) \
68 DECL_NAME (TYPE_NAME (type)) = name; \
70 TYPE_NAME (type) = name;
73 #define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->objc_info
74 #undef SIZEOF_OBJC_TYPE_LANG_SPECIFIC
75 #define SIZEOF_OBJC_TYPE_LANG_SPECIFIC sizeof (struct lang_type_class)
76 #undef ALLOC_OBJC_TYPE_LANG_SPECIFIC
77 #define ALLOC_OBJC_TYPE_LANG_SPECIFIC(NODE) \
79 TYPE_LANG_SPECIFIC (NODE) = GGC_CNEWVAR \
80 (struct lang_type, sizeof (struct lang_type_class)); \
81 TYPE_LANG_SPECIFIC (NODE)->u.c.h.is_lang_type_class = 1; \
84 #define OBJCP_ORIGINAL_FUNCTION(name, args) (name)args
86 /* C++ marks ellipsis-free function parameters differently from C. */
87 #undef OBJC_VOID_AT_END
88 #define OBJC_VOID_AT_END void_list_node
90 #endif /* OBJCP_REMAP_FUNCTIONS */
92 #endif /* ! GCC_OBJCP_DECL_H */