Commit Graph

4 Commits

Author SHA1 Message Date
Slava Pestov
04db869d80 SILGen: Simplify delayed conformance emission
Instead of visiting all types in the ExternalDefinitions list and
queuing up their conformances, just emit conformances as needed
when they are first referenced.
2019-05-18 11:35:05 -04:00
Slava Pestov
a0197b38ea SILGen: Some fixes for lazy conformance emission
- Don't forget to walk the top-level 'main' function

- Force _ObjectiveCBridgeable and _BridgedStoredNSError conformances
  for types mentioned in apply instructions, existential erasure and
  casts

- Only walk each unique CanType once, and skip non-ClangImporter
  synthesized conformances completely

- Add a few missing cases
2019-04-25 22:27:16 -04:00
Slava Pestov
cf60ed5bf0 SILGen: Force lazy conformances referenced from various places in the AST
SILGen has the ability to lazily emit ClangImporter-synthesized
conformances. Sema builds a per-SourceFile list of "used" conformances,
which are forced to be emitted by SILGen. All other conformances can be
emitted lazily.

Some of these "used" conformances are in fact not referenced by SILGen
at all, but must exist for emission by IRGen so that they can be
referenced from type metadata accessors, as well as available at
runtime for the dynamic cast machinery.

To handle these cases, add an AST walk to SILGen which emits the types
of stored properties, the superclass of a class, and a few other
things that might not be referenced directly from SIL.

For now, this is all redundant because Sema forces the right
conformances anyway, but that's going to change soon.
2019-04-25 22:22:58 -04:00
Slava Pestov
8a74e52273 SILGen: Add post-processing pass to lazily emit ClangImproter-synthesized conformances 2019-04-25 02:05:20 -04:00