Commit graph

7267 commits

Author SHA1 Message Date
Bill Currie
daa88d8f1c Fix a type clash warning I'd failed to notice. 2011-02-08 08:23:25 +09:00
Bill Currie
35d53d0d77 Fix typedefs and class names once and for all.
I suspect Holub did them that way as a teaching exercise :P
2011-02-08 08:20:32 +09:00
Bill Currie
7e2173f268 Remove some old code. 2011-02-08 08:16:36 +09:00
Bill Currie
d6b10c99aa Most, if not all, of the fixes needed to get qwaq building.
This is pretty much just changing [] to * and moving [N] to the other side
of the variable name.
2011-02-07 22:16:16 +09:00
Bill Currie
92799650c0 Implement struct field access via a pointer. 2011-02-07 22:15:10 +09:00
Bill Currie
7a1a9e3f2d Better handling of the current storage for function scopes. 2011-02-07 22:11:22 +09:00
Bill Currie
ff70177041 Fix type handling for local variables. 2011-02-07 21:38:58 +09:00
Bill Currie
952a02eb23 Make print_type() output a newline. 2011-02-07 21:31:37 +09:00
Bill Currie
a28ac636a7 Make local declarations support C syntax. 2011-02-07 21:29:04 +09:00
Bill Currie
da4ec3d47c Allow typedefs and classes in structs. 2011-02-07 20:55:13 +09:00
Bill Currie
aefd2a27d5 Make type handling in the grammar more consistent. 2011-02-07 20:54:49 +09:00
Bill Currie
3c64ae7b66 Fix overzealous type merging.
Use the type name instead of the symbol table for comparing
struct/union/enum types.
2011-02-07 20:48:01 +09:00
Bill Currie
265a244ba2 Set the symbol type for structs etc as soon as the tag is created.
Tags (struct/union/enum) are always types.
2011-02-07 15:30:49 +09:00
Bill Currie
65a07ada1c Implement offset dereferences. 2011-02-07 14:56:29 +09:00
Bill Currie
d2b464053c Fix assignment sub-expressions. 2011-02-07 14:43:07 +09:00
Bill Currie
6fa5bbe473 Support constant folding on enums. 2011-02-07 11:31:23 +09:00
Bill Currie
d549e5c6b5 Allow enums to be tested. 2011-02-07 11:30:56 +09:00
Bill Currie
ef2ad46f7a Convert complex types to a suitable low-level type.
This takes care of moving structures etc around.
2011-02-07 10:55:09 +09:00
Bill Currie
b629c12b31 Do not change the type of the return operand.
Doing so made a mess of returning expressions. It was probably a holdover
from before getting instructions with void operand types working.
2011-02-07 10:21:54 +09:00
Bill Currie
829fb33e92 Fix converting nil to a pointer type. 2011-02-07 10:10:48 +09:00
Bill Currie
b8127f7543 Do not segfault when printing a pointer value with a bogus type 2011-02-07 09:57:26 +09:00
Bill Currie
28ba4b5712 Correct a comment. 2011-02-07 09:56:33 +09:00
Bill Currie
d564e6f017 Clean out the old debug prints from emit_function() 2011-02-07 08:46:12 +09:00
Bill Currie
76034861c9 Implement direct ivar access in methods.
A warning needs to be generated for access to ivars in a class method, but
it seems to work (unable to check due to other errors).
2011-02-07 08:32:52 +09:00
Bill Currie
3025e04ac5 Partially resurrect field_expr()
For now, only entity.field and ivar access via a pointer have been
implemented. The rest will come later as needed.
2011-02-07 08:30:28 +09:00
Bill Currie
1d108a8cec Support emitting symbolic constants. 2011-02-06 20:08:54 +09:00
Bill Currie
e4ac92b5f2 Auto-cast between enums and the default type. 2011-02-06 20:08:16 +09:00
Bill Currie
6b7a81f5a7 Run find_type() early on enums and structs. 2011-02-06 20:07:19 +09:00
Bill Currie
d54a96e68a Make enum values visible.
Put them in the current symbol table as well as the enum symbol table. The
latter is really just for keeping track of what values are in the enum.
2011-02-06 20:06:09 +09:00
Bill Currie
2860a8b28b enum too is a scalar. 2011-02-06 20:01:55 +09:00
Bill Currie
f2c272f0b8 Make adding a symbol to multiple tables an internal error. 2011-02-06 20:00:14 +09:00
Bill Currie
d7cdf8077b Rename id_ivars to object_ivars. 2011-02-06 15:41:15 +09:00
Bill Currie
c3c693e9c7 Correct construction of type_id. 2011-02-06 15:36:21 +09:00
Bill Currie
e27f3fd7c3 Copy the method's params into the method symbol. 2011-02-06 15:14:42 +09:00
Bill Currie
00bba1eb3a Fix creation of uninitialized global variables. 2011-02-06 14:37:25 +09:00
Bill Currie
59d3dc6ae0 Check early for assignment of a class pointer to id. 2011-02-06 14:35:17 +09:00
Bill Currie
2f7b892452 Fix passing messages to classes.
Rename class_pointer_def() to class_pointer_symbol() and use it when a
class name is used as the receiver of a message.
2011-02-06 14:34:40 +09:00
Bill Currie
67957a14df Bring back convert_name(), but siimplified.
It is now mainly for converting __FILE__ etc, handling expression symbols,
and checking for undefined identifiers.
2011-02-06 14:29:14 +09:00
Bill Currie
d03fdc5e67 Correctly calculate the size of the ivars of a class.
Need to include the size of the super class ivars.
2011-02-05 00:04:35 +09:00
Bill Currie
690ae1cb57 Fix send_message(). 2011-02-04 23:49:25 +09:00
Bill Currie
29fbc3b073 Struct and ivar declarations now seem to work.
However, not bit-fields.
2011-02-04 23:48:58 +09:00
Bill Currie
1f6abb2cce Minor cleanups to message_expr().
Fix for class names no longer being pointers to the class.
2011-02-04 23:22:51 +09:00
Bill Currie
eff3957487 Resurrect the address expression code for arrays etc.
This fixes selector finding.
2011-02-04 23:20:37 +09:00
Bill Currie
c542e1a453 Possibly fix normal methods. 2011-02-04 22:31:23 +09:00
Bill Currie
d9446c5eb0 Fix builtin methods. 2011-02-04 22:31:22 +09:00
Bill Currie
d0ecbb38b8 Copy the spec bits and storage class for QC functions. 2011-02-04 15:25:21 +09:00
Bill Currie
f721144ca5 Rewrite emit_ivars to use emit_structure.
The old code was broken anyway :) (it was segfaulting).
2011-02-04 15:11:47 +09:00
Bill Currie
acb3c0da11 Fix class initialization. 2011-02-04 14:29:47 +09:00
Bill Currie
04b86fcdb7 Move the Objective-QC structs from type.c to class.c 2011-02-04 12:07:32 +09:00
Bill Currie
7b22bfba63 Better Objective-QC keyword detection.
Use a flag in the keyword struct rather than checking for "@" in the
keyword. This catches such keywords as "id" and "Protocol" as well.
2011-02-04 08:38:58 +09:00