OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [objcp/] [objcp-decl.c] - Blame information for rev 20

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* 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>
5
 
6
This file is part of GCC.
7
 
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
11
version.
12
 
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
16
for more details.
17
 
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
21
02110-1301, USA.  */
22
 
23
#include "config.h"
24
#include "system.h"
25
#include "coretypes.h"
26
#include "tm.h"
27
#include "tree.h"
28
#include "rtl.h"
29
#include "expr.h"
30
#include "cp-tree.h"
31
#include "c-common.h"
32
#include "flags.h"
33
#include "input.h"
34
#include "except.h"
35
#include "output.h"
36
#include "toplev.h"
37
#include "cpplib.h"
38
#include "debug.h"
39
#include "target.h"
40
#include "varray.h"
41
 
42
#include "objc-act.h"
43
#include "objcp-decl.h"
44
 
45
/* Hacks to simulate start_struct() and finish_struct(). */
46
 
47
tree
48
objcp_start_struct (enum tree_code code ATTRIBUTE_UNUSED, tree name)
49
{
50
  tree s;
51
  /* The idea here is to mimic the actions that the C++ parser takes when
52
     constructing 'extern "C" struct NAME {'.  */
53
  push_lang_context (lang_name_c);
54
 
55
  if (!name)
56
    name = make_anon_name ();
57
 
58
  s = xref_tag (record_type, name, ts_global, 0);
59
  CLASSTYPE_DECLARED_CLASS (s) = 0;  /* this is a 'struct', not a 'class'.  */
60
  xref_basetypes (s, NULL_TREE);     /* no base classes here!  */
61
 
62
  return begin_class_definition (s);
63
}
64
 
65
tree
66
objcp_finish_struct (tree t, tree fieldlist, tree attributes)
67
{
68
  tree field, next_field;
69
 
70
  for (field = fieldlist; field; field = next_field)
71
  {
72
    next_field = TREE_CHAIN (field);      /* insert one field at a time;  */
73
    TREE_CHAIN (field) = NULL_TREE;       /* otherwise, grokfield croaks. */
74
    finish_member_declaration (field);
75
  }
76
  t = finish_struct (t, attributes);
77
  pop_lang_context ();
78
 
79
  return t;
80
}
81
 
82
void
83
objcp_finish_function (void)
84
{
85
  /* The C++ flavor of 'finish_function' does not generate RTL -- one has
86
     to call 'expand_or_defer_fn' to do that.  */
87
  expand_or_defer_fn (finish_function (0));
88
}
89
 
90
tree
91
objcp_lookup_name (tree name)
92
{
93
  return lookup_name (name, -1);
94
}
95
 
96
tree
97
objcp_xref_tag (enum tree_code code ATTRIBUTE_UNUSED, tree name)
98
{
99
  return xref_tag (record_type, name, ts_global, false);
100
}
101
 
102
int
103
objcp_comptypes (tree type1, tree type2)
104
{
105
  return comptypes (type1, type2, COMPARE_STRICT);
106
}
107
 
108
tree
109
objcp_begin_compound_stmt (int flags ATTRIBUTE_UNUSED)
110
{
111
  return begin_compound_stmt (0);
112
}
113
 
114
tree
115
objcp_end_compound_stmt (tree stmt, int flags ATTRIBUTE_UNUSED)
116
{
117
  /* The following has been snarfed from
118
     cp/semantics.c:finish_compound_stmt().  */
119
  if (TREE_CODE (stmt) == BIND_EXPR)
120
    BIND_EXPR_BODY (stmt) = do_poplevel (BIND_EXPR_BODY (stmt));
121
  else if (STATEMENT_LIST_NO_SCOPE (stmt))
122
    stmt = pop_stmt_list (stmt);
123
  else
124
    stmt = do_poplevel (stmt);
125
 
126
  return stmt;
127
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.