Commit Graph

428 Commits

Author SHA1 Message Date
Joe Groff
827cbfe0b0 IRGen: Dynamic init for repl ObjC extensions.
When running in immediate mode, generate a global initializer when an extension is defined for an ObjC class that uses the class_replaceMethod runtime function to dynamically add the extension methods to the ObjC class.

Swift SVN r4153
2013-02-22 21:08:39 +00:00
Joe Groff
a9f747ec1f IRGen: Emit categories for ObjC class extensions.
Emit ObjC stubs and categories for methods defined in extensions of ObjC-compatible classes. This makes extensions of ObjC classes available to ObjC in statically compiled code. For immediate-mode code we'll still need to dynamically register extension methods using the ObjC runtime.

Swift SVN r4149
2013-02-22 05:40:09 +00:00
Joe Groff
4792c60d2d IRGen: Implement super method calls.
For Objective-C super calls, build an objc_super struct value containing the receiver and class/metaclass object and pass it to objc_msgSendSuper2. For Swift super calls, emit a direct call to the super implementation.

Swift SVN r4023
2013-02-13 02:41:20 +00:00
Joe Groff
45e5909911 IRGen: Export objc methods w/ NSRect return/args.
Fix up the thunk generator so it knows how to turn byval C arguments back into Swift explosions, so that methods that take NSRects as arguments or give NSRect as their return value can be exported as objc methods.

Swift SVN r4010
2013-02-10 17:24:27 +00:00
Joe Groff
9c022d5d65 IRGen: Fudge passing large ObjC structs as byvals.
Push LLVM attribute generation from expandAbstractCC into getFunctionSignature and CallEmission so that they can generate sret and/or byval attributes per-argument according to the calling convention. Copy our bogus rule for emitting sret returns (more than three elements in the explosion) and reuse it to pass large struct values as byvals rather than as explosions. This should be good enough to get both 'NSRect' and
'NSRange', 'NSSize' etc. to pass correctly to ObjC methods. Next step is to set the AbstractCC correctly for imported func decls so that standalone C functions follow the same bogus rule.

Swift SVN r3993
2013-02-08 21:50:08 +00:00
Jordan Rose
b44f38ef44 Emit ObjC method types for getters that return (class) objects.
This is needed for KVC.

Swift SVN r3987
2013-02-08 00:19:53 +00:00
Jordan Rose
7654aad18b llvm::Twine can only be used as a temporary.
Fixes r3839.

Swift SVN r3842
2013-01-23 19:41:12 +00:00
Jordan Rose
5f2f5e1713 Selector data symbols should be prefixed with "\01L".
Failing to do this causes linker assertions.

Swift SVN r3841
2013-01-23 18:49:17 +00:00
John McCall
18cde6ed7c ObjC method records have selector data pointers, not
selector ref pointers.

Swift SVN r3808
2013-01-19 10:06:56 +00:00
John McCall
0877541503 Given selector-data arrays a more semantic name.
Swift SVN r3805
2013-01-19 10:06:50 +00:00
John McCall
02c3c8703d Collect references to non-generic classes in __DATA,__objc_classlist.
Swift SVN r3788
2013-01-17 23:54:09 +00:00
John McCall
b15b306314 Emit ObjC metadata and swift-as-ObjC thunks for methods.
Swift SVN r3697
2013-01-05 23:46:24 +00:00
Chris Lattner
47dbc4051c update for mainline LLVM header file moves.
Swift SVN r3634
2013-01-02 14:38:42 +00:00
John McCall
521f0742b4 Account for types that explode to sizes != 1 when computing the
consumed arguments of a method.

Swift SVN r3464
2012-12-13 00:24:42 +00:00
John McCall
4b246bce50 Implement the ObjC ownership conventions, using ARC-in-clang's
method annotations when possible.

Swift SVN r3427
2012-12-10 08:18:11 +00:00
John McCall
c6374093f6 Add support for messaging Objective-C classes.
Notably, there is still no support for +1 return values,
so we'll leak when doing alloc/init and so on;  but this gets
the fundamentals in place.  A lot of the extra stuff in here
is dealing with mapping between metatypes and class objects.

Swift SVN r3425
2012-12-10 08:18:03 +00:00
Doug Gregor
1722411007 When we're referring to the SEL type in IRGen, use a names alias for i8*.
Swift SVN r3404
2012-12-07 17:19:39 +00:00
Doug Gregor
07be3f3e7f Use the Objective-C runtime to unique selectors in JIT'd code.
When generating IR for the JIT, use sel_registerName() to unique the
selector references we generate. Static code doesn't need this
pessimization. Fixes <rdar://problem/12764732>.


Swift SVN r3403
2012-12-07 17:13:27 +00:00
Doug Gregor
f80ff2c565 Make sure that generated selector symbols actually get uniqued.
First, keep track of each of the selectors we emit and dump them into the
llvm.used global so that they don't get thrown away by the
optimizer. Second, emit Objective-C module-level named metadata so
that the linker knows it needs to unique selectors. Otherwise,
uniquing doesn't happen when Swift code is compiled into a separate
dylib.


Swift SVN r3287
2012-11-29 00:56:41 +00:00
John McCall
2568c1b043 getSelector -> getObjCSelector per Doug's review.
Swift SVN r3186
2012-11-14 19:30:22 +00:00
John McCall
7c277001a4 Implement basic objc_msgSend capabilities.
Swift SVN r3104
2012-11-03 00:26:56 +00:00
John McCall
7a95ef9a5f Add code to generate the globals behind selectors.
Untestable so far.

Swift SVN r3090
2012-10-30 00:21:16 +00:00
John McCall
07482e6de1 If the root class in a hierarchy is marked with [objc], we
have to use objc_retain/release.

Swift SVN r3089
2012-10-30 00:20:40 +00:00
John McCall
84f3b7f884 Unify the ObjC and Swift heap pointer TypeInfos.
Swift SVN r3088
2012-10-30 00:19:33 +00:00
John McCall
6c821ddc1b Support allocating local objects of archetype type, at least in
theory.

Swift SVN r2245
2012-06-25 20:45:04 +00:00
John McCall
770ce0fde7 Refactor to make it easier to keep common information in
the type converter.

Swift SVN r2241
2012-06-25 20:44:59 +00:00
John McCall
06992eec7a Introduce helper templates to make it easier to define
type infos that can be efficiently scalarized.

Swift SVN r1904
2012-05-19 03:16:08 +00:00
John McCall
38bac7c706 Add Builtin.ObjCPointer with accompanying IR-gen support and
wrap it in an 'id' type in the standard library.

Also fix a bug noticed by inspection where initWithTake for
function types wasn't entering a cleanup for the taken value.
This probably doesn't matter for existing possibilities, but
it's potentially important under exceptions.

Swift SVN r1902
2012-05-18 23:40:17 +00:00