Commits

Doug Gregor committed 86b7322e87b
[Sema -> AST] Refactor "is representable in Objective-C?" checking. Migrate the check for whether a given type is representable in Objective-C, which is currently used to verify when @objc can be inferred or verify that an explicitly-written @objc is well-formed, from Sema into a set of queries on the Type within the AST library, so it can be used in other parts of the compiler. As part of this refactoring, clean up and improve a number of aspects of this code: * Unify the "trivially representable" and "representable" code paths into a single code path that covers these cases. Clarify the different levels of "representable" we have in both the code and in comments. * Distinguish between representation in C vs. representation in Objective-C. While we aren't using this now, I'm anticipating it being useful to allow exporting C interfaces via @_cdecl (or similar). * Eliminate the special cases for bridging String/Array/Dictionary/Set with their Foundation counterparts; we now consult _ObjectiveCBridgeable conformances exclusively to get this information. * Cache foreign-representation information on the ASTContext in a manner that will let us more easily get the right answer across different contexts while providing more sharing than the TypeChecker version. Annoyingly, this only seemed to fix a small class of error where we were permitting Unsafe(Mutable)Pointer<T> to be representable in Objective-C when T was representable but not trivially representable, e.g., T=String or T=AnyObject.Type.