If an archetype has a superclass bound, we can assume the superclass's
retain semantics for the type. We can also use the superclass's storage pointer type to cut down on some bitcast IR noise when calling superclass methods on the archetype value.
Swift SVN r5642
In the implementation of class-bounded archetypes and existentials, instead of referring to ObjC pointer types and retain/release operations directly, use an 'UnknownRefCountedPtrTy' and 'emitUnknownRetain/Release' functions.
Swift SVN r5619
Add overloads of getFragileTypeInfo and getFunctionType that take a SILType instead of a Swift CanType, and use them where it's easy to do so. Right now they just forward to the CanType versions, but we'll want to do SILType-specific type conversion soon. Clean up some IRGenSILFunction interfaces now that SILFunction carries most of the information IRGen needs intrinsically. No functionality change.
Swift SVN r5141
Emit the deallocObject runtime call inside the deallocating destructor for a heap object, instead of inside swift_release. This will allow for heap objects with known size to directly call fast deallocator entry points and potentially custom deallocators in the future.
Swift SVN r5027
Find function bodies and emit their local type decls using the AST instead of relying on SILConstants to point the way back to the function bodies.
Swift SVN r4916
Change the destroying destructor entry point ABI to take 'this' as the appropriate type instead of as %swift.refcounted. Emit the deallocating destructor in IRGen when we see the ClassDecl, not when we see the SILFunction for the destructor. This frees us from having to worry about whether a SILFunction came from a destructor decl. We won't be able to reconstruct that once SILFunctions are pre-mangled.
While we're here, repaint some bikesheds so it's clearer that SIL and SILGen work with the destroying destructor.
Swift SVN r4908
ObjC classes don't have a deallocating destructor, so we can't call up to it in a class derived from an ObjC class. Hack SILGen not to emit a call to the superclass destructor of a class inherited from an ObjC class. This is the wrong thing, but it looks like destructors don't get hooked up to ObjC dealloc methods anyway yet, so what the Swift destructor of an ObjC-derived class does is moot right now. This lets us remove the guards from IRGen that prevented ObjC destructors from being emitted.
Swift SVN r4784
Teach SILGen how to emit the implicit elementwise constructor for structs and the implicit default constructor for classes, and eliminate the now dead IRGen code for them. Add a StructInst SIL instruction to represent constructing a loadable struct value from elements, analogous to TupleInst for tuples.
Swift SVN r4778
LLVM r179073 fixed PointerIntPair to work with an enum class as the IntType member, so we can kill some boilerplate in a few type implementations that were explicitly casting to unsigned to work around PointerIntPair's limitations.
Swift SVN r4652
At the top level, if 'operator' is followed by 'infix', 'prefix', or 'postfix', consider it a contextual keyword, and parse an operator decl following it that looks like:
operator {infix|postfix|prefix} <+> {
attributes…
}
Prefix and postfix operator decls currently admit no attributes. Infix operators have 'associativity {left|right|none}' and 'precedence <int>' attributes.
This patch implements parsing for operator declarations but does not yet attach the declared attributes to func decls for the operators.
Swift SVN r4596
Emit getter and setter ObjC methods and selectors for Swift properties declared in ObjC classes or extensions. If the type of the property is an ObjC class, also emit special-cased ObjC formal property metadata for the property as if it were declared @property (nonatomic, {readonly,strong}) in ObjC.
Swift SVN r4207
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
Oops, missed a spot where it was referring to 'DeclAttributes::ObjC' directly instead of going through the accessor. This should make removing [objc] from the examples work.
Swift SVN r4100
Add 'isObjC' as a property of ValueDecl, and set it during type checking if a class is either explicitly annotated with an [objc] attribute or inherits from an isObjC class, or if a func is a method of an isObjC class. Tweak the ClangImporter and other places that summon magic ValueDecl nodes to set up the decls they synthesize as isObjC. Replace logic in typechecking and IRGen that branched on the 'isObjC' attribute to now branch on the 'isObjC' property of ValueDecls.
Swift SVN r4078
In the StmtChecker, consider a ConstructorDecl or DestructorDecl context to be a function context that returns (). In IRGen for constructors and destructors, set up proper return blocks so that 'return' does the right thing, and in constructors, pretend that the body has no return value even though the underlying constructor mechanism totally returns a value. Fixes <rdar://problem/12950817>.
Swift SVN r3915
We can't naively assume that the allocating constructor's metatype is the very last argument. If there are protocol constraints on the class's generic parameters, those witness tables will get passed in afterward. Add some hacky logic to emitClassAllocatingConstructor to gather witness tables and forward them to the initializing constructor. The added test cases are broken because of <rdar://problem/12965934>.
Swift SVN r3906
Emit separate entry points for the allocating and initializing constructors. 'super.constructor' now works for the small subset of cases for which I've implemented sema support.
Swift SVN r3864
Emit the SIL destructor as a destroying destructor, then emit a deallocating destructor shim that calls into it and then returns the heap size. (The actual deallocation still happens in swift_release--I talked to John about that and I'll fix it later.) This gets the broken SIL/IRGen class tests passing again.
Swift SVN r3838
Remove the filter that only irgenned SIL functions for FuncDecls so that we emit functions for all SIL decls, and disable the old paths for properties, constructors, and destructors when a SIL module is present. Unfortunately this breaks class constructors because SIL and IRGen don't agree on how initializing constructors should work. I need to sync with John to figure out how to fix that.
Swift SVN r3827
Implement AllocRefInst so that SIL-emitted constructors can be irgenned. Factor the code for allocating a class instance from GenClass's emitClassConstructor function.
Swift SVN r3826