bool hasAtMostOneOpenedArchetype(CanType Ty) {
  int NumOpenedArchetypes = 0;
  Ty.visit([&](Type t) {
    if (t->isOpenedExistential()) {
      NumOpenedArchetypes++;
    }
    return;
  });
  return NumOpenedArchetypes <= 1;
}
Example #2
0
  // Collect any builtin types referenced from this type.
  void addBuiltinTypeRefs(CanType type) {
    type.visit([&](Type t) {
      if (t->is<BuiltinType>())
        BuiltinTypes.insert(CanType(t));

      // We need at least size/alignment information for types imported by
      // clang, so we'll treat them as a builtin type, essentially an
      // opaque blob.
      if (auto Nominal = t->getAnyNominal())
        if (Nominal->hasClangNode())
          BuiltinTypes.insert(CanType(t));
    });
  }
Example #3
0
  // Collect any builtin types referenced from this type.
  void addBuiltinTypeRefs(CanType type) {
    type.visit([&](Type t) {
      if (t->is<BuiltinType>())
        IGM.BuiltinTypes.insert(CanType(t));

      // We need size/alignment information for imported value types,
      // so emit builtin descriptors for them.
      //
      // In effect they're treated like an opaque blob, which is OK
      // for now, at least until we want to import C++ types or
      // something like that.
      //
      // Classes and protocols go down a different path.
      if (auto Nominal = t->getAnyNominal())
        if (Nominal->hasClangNode()) {
          if (auto CD = dyn_cast<ClassDecl>(Nominal))
            IGM.ImportedClasses.insert(CD);
          else if (auto PD = dyn_cast<ProtocolDecl>(Nominal))
            IGM.ImportedProtocols.insert(PD);
          else
            IGM.BuiltinTypes.insert(CanType(t));
        }
    });
  }
Example #4
0
 // Collect any builtin types referenced from this type.
 void addBuiltinTypeRefs(CanType type) {
   type.visit([&](Type t) {
     if (t->is<BuiltinType>())
       BuiltinTypes.insert(CanType(t));
   });
 }