On some platforms (for example, x86_64), the first call to
`objc_autoreleaseReturnValue` will always autorelease because it would
fail to verify the instruction sequence in the caller. On x86_64
certain PLT entries would be still pointing to the resolver function,
and sniffing the call sequence would fail.
This change adds a "warmup" return-autoreleased sequence to the test
harness.
rdar://18385128
Swift SVN r22127
Removes the initWithBool: hack from the Clang importer. We can now
express NSNumber's conformance to the BooleanLiteralConvertible
protocol in the overlay.
Swift SVN r21976
Conforming to BooleanLiteralConvertible now requires
init(booleanLiteral: Bool)
rather than
static func convertFromBooleanLiteral(value: Bool) -> Self
This posed a problem for NSNumber's conformance to
BooleanLiteralConvertible. A class needs a required initializer to
satisfy an initializer requirement, but one cannot add a required
initializer via an extension. To that end, we hack the Clang importer
to import NSNumber's initWithBool with the name
init(booleanLiteral:)
and add back the expected init(bool:) initializer in the
overlay. These tricks make NSNumber even harder to subclass, but we
don't really care: it's nearly impossible to do well anyway, and is
generally a Bad Idea.
Part of rdar://problem/18154091.
Swift SVN r21961
This is a case of type mismatch due to the parameter type not being a proper
NS_OPTIONS enum. However, it crashes at runtime on 32 bit, so let's introduce an
overlay while waiting for the proper fix.
Addresses radar://18201112
Swift SVN r21957
Per API review with Ali. While we're here, give the initializer a corresponding 'rawValue' argument label, and change the associated type name to RawValue to match.
Swift SVN r21888
While Foundation actually defines the NSZone typedef and what you can do with
it, the ObjectiveC module makes use of it in its raw form: "struct _NSZone *".
To avoid a circular dependency, sink our adapter down to the ObjectiveC
overlay.
Swift SVN r21827
Redefine the RawRepresentable protocol to use an 'init?' method instead of 'fromRaw(Raw)', and a 'raw' get-only property instead of 'toRaw()'. Update the compiler to support deriving conformances for enums and option sets with the new protocol. rdar://problem/18216832
Swift SVN r21762
The syntax being reverted added busywork and noise to the common case
where you want to say "I have the right address, but the wrong type,"
without adding any real safety.
Also it eliminated the ability to write UnsafePointer<T>(otherPointer),
without adding ".self" to T. Overall, it was not a win.
This reverts commits r21324 and r21342
Swift SVN r21424
Depending on visitation order, we would occasionally leave the factory
method available if we had completely imported the initializer
first. Fixes <rdar://problem/17261609>.
Swift SVN r21361
Previously, it was possible to write Unsafe[Mutable]Pointer(x) and have
Swift deduce the pointee type based on context. Since reinterpreting
memory is a fundamentally type-unsafe operation, it's better to be
explicit about conversions from Unsafe[Mutable]Pointer<T> to
Unsafe[Mutable]Pointer<U>. This change is consistent with the move from
reinterpretCast(x) to unsafeBitCast(x, T.self).
Also, we've encoded the operations of explicitly adding or removing
mutability as properties, so that adding mutability can be separated
from wild reinterpretCast'ing, a much more severe form of unsafety.
Swift SVN r21324
This allows UnicodeScalars to be constructed from an integer, rather
then from a string. Not only this avoids an unnecessary memory
allocation (!) when creating a UnicodeScalar, this also allows the
compiler to statically check that the string contains a single scalar
value (in the same way the compiler checks that Character contains only
a single extended grapheme cluster).
rdar://17966622
Swift SVN r21198
Now that CGFloat is its own distinct type, it's useful to have Double
initializers to go along with the Int initializers we added a while
back <rdar://problem/17224725>.
Swift SVN r21156
The determination of “favored” constraints for binary expressions was comparing the second argument to the first parameter to decide if the constraint is favored. Coupled with implicit bridging conversions through NSNumber, this meant that “1.0/10” would become Int when Foundation was imported, and hilarity ensued.
Fix the heuristic for favored constraints, tidy up this code a bit, and add ==(NSString, NSString) to cope with the ambiguity this creates.
Swift SVN r21154
Instead of trying to bridge NSDictionary to [String:String], XCTest needs to
just request the objects from the NSDictionary as String.
Also, move the unwrapping of the optional from the might-throw block such that
it only happens when the block hasn't thrown. Unwrapping the optional if the
block has thrown would crash, because the optional would still be unset.
Addresses <rdar://problem/17952584>.
Swift SVN r21119
Also, move the ObjectiveC overlay into its own directory, so that we can
use the directory name as an indicator of what overlays exist.
This is in preparation for DevPubs providing the contents of the apinotes/
directory. The downside here is that adding new apinotes files doesn't
automatically trigger a rebuild; I intend to mitigate that somewhat by at
least triggering one when the revision number of the DevPubs repo changes.
Swift SVN r21078
stringByAddingPercentEncodingWithAllowedCharacters() and
stringByAddingPercentEscapesUsingEncoding() to String?, and add API notes for
NSString to the same effect
Swift SVN r21007