@@ -48,6 +48,8 @@ class Fingerprint;
48
48
class Identifier ;
49
49
class IfConfigClauseRangeInfo ;
50
50
struct LabeledStmtInfo ;
51
+ class LayoutConstraint ;
52
+ class LayoutConstraintInfo ;
51
53
struct LifetimeDescriptor ;
52
54
enum class MacroRole : uint32_t ;
53
55
class MacroIntroducedDeclName ;
@@ -58,6 +60,7 @@ class ProtocolConformanceRef;
58
60
class RegexLiteralPatternFeature ;
59
61
class RegexLiteralPatternFeatureKind ;
60
62
enum class ReferenceOwnership : uint8_t ;
63
+ class RequirementRepr ;
61
64
class Type ;
62
65
class CanType ;
63
66
class TypeBase ;
@@ -2677,58 +2680,105 @@ SWIFT_NAME("getter:BridgedPattern.boundName(self:)")
2677
2680
BridgedIdentifier BridgedPattern_getBoundName(BridgedPattern cPattern);
2678
2681
2679
2682
// ===----------------------------------------------------------------------===//
2680
- // MARK: Misc
2683
+ // MARK: Generics
2681
2684
// ===----------------------------------------------------------------------===//
2682
2685
2683
- struct BridgedTupleTypeElement {
2684
- BridgedIdentifier Name;
2685
- BridgedSourceLoc NameLoc;
2686
- BridgedIdentifier SecondName;
2687
- BridgedSourceLoc SecondNameLoc;
2688
- BridgedSourceLoc UnderscoreLoc;
2689
- BridgedSourceLoc ColonLoc;
2690
- BridgedTypeRepr Type;
2691
- BridgedSourceLoc TrailingCommaLoc;
2686
+ enum ENUM_EXTENSIBILITY_ATTR (closed) BridgedLayoutConstraintKind {
2687
+ BridgedLayoutConstraintKindUnknownLayout,
2688
+ BridgedLayoutConstraintKindTrivialOfExactSize,
2689
+ BridgedLayoutConstraintKindTrivialOfAtMostSize,
2690
+ BridgedLayoutConstraintKindTrivial,
2691
+ BridgedLayoutConstraintKindClass,
2692
+ BridgedLayoutConstraintKindNativeClass,
2693
+ BridgedLayoutConstraintKindRefCountedObject,
2694
+ BridgedLayoutConstraintKindNativeRefCountedObject,
2695
+ BridgedLayoutConstraintKindBridgeObject,
2696
+ BridgedLayoutConstraintKindTrivialStride,
2692
2697
};
2693
2698
2699
+ class BridgedLayoutConstraint {
2700
+ swift::LayoutConstraintInfo *_Nullable raw;
2701
+
2702
+ public:
2703
+ SWIFT_UNAVAILABLE (" Use the factory methods" )
2704
+ BRIDGED_INLINE BridgedLayoutConstraint ();
2705
+
2706
+ SWIFT_UNAVAILABLE (" Use the factory methods" )
2707
+ BRIDGED_INLINE BridgedLayoutConstraint (swift::LayoutConstraint constraint);
2708
+
2709
+ BRIDGED_INLINE swift::LayoutConstraint unbridged () const ;
2710
+ };
2711
+
2712
+ SWIFT_NAME (" BridgedLayoutConstraint.getLayoutConstraint(_:id:)" )
2713
+ BridgedLayoutConstraint
2714
+ BridgedLayoutConstraint_getLayoutConstraint(BridgedASTContext cContext,
2715
+ BridgedIdentifier cID);
2716
+
2717
+ SWIFT_NAME (" BridgedLayoutConstraint.getLayoutConstraint(_:kind:)" )
2718
+ BridgedLayoutConstraint
2719
+ BridgedLayoutConstraint_getLayoutConstraint(BridgedASTContext cContext,
2720
+ BridgedLayoutConstraintKind cKind);
2721
+
2722
+ SWIFT_NAME (
2723
+ " BridgedLayoutConstraint.getLayoutConstraint(_:kind:size:alignment:)" )
2724
+ BridgedLayoutConstraint
2725
+ BridgedLayoutConstraint_getLayoutConstraint(BridgedASTContext cContext,
2726
+ BridgedLayoutConstraintKind cKind,
2727
+ size_t size, size_t alignment);
2728
+
2729
+ SWIFT_NAME (" getter:BridgedLayoutConstraint.isNull(self:)" )
2730
+ BRIDGED_INLINE bool
2731
+ BridgedLayoutConstraint_isNull(BridgedLayoutConstraint cConstraint);
2732
+
2733
+ SWIFT_NAME (" getter:BridgedLayoutConstraint.kind(self:)" )
2734
+ BridgedLayoutConstraintKind
2735
+ BridgedLayoutConstraint_getKind(BridgedLayoutConstraint cConstraint);
2736
+
2737
+ SWIFT_NAME (" getter:BridgedLayoutConstraint.isKnownLayout(self:)" )
2738
+ BRIDGED_INLINE bool
2739
+ BridgedLayoutConstraint_isKnownLayout(BridgedLayoutConstraint cConstraint);
2740
+
2741
+ SWIFT_NAME (" getter:BridgedLayoutConstraint.isTrivial(self:)" )
2742
+ BRIDGED_INLINE bool
2743
+ BridgedLayoutConstraint_isTrivial(BridgedLayoutConstraint cConstraint);
2744
+
2694
2745
enum ENUM_EXTENSIBILITY_ATTR (open) BridgedRequirementReprKind : size_t {
2695
- // / A type bound T : P, where T is a type that depends on a generic
2696
- // / parameter and P is some type that should bound T, either as a concrete
2697
- // / supertype or a protocol to which T must conform.
2698
2746
BridgedRequirementReprKindTypeConstraint,
2699
-
2700
- // / A same-type requirement T == U, where T and U are types that shall be
2701
- // / equivalent.
2702
2747
BridgedRequirementReprKindSameType,
2703
-
2704
- // / A layout bound T : L, where T is a type that depends on a generic
2705
- // / parameter and L is some layout specification that should bound T.
2706
2748
BridgedRequirementReprKindLayoutConstraint,
2707
-
2708
- // Note: there is code that packs this enum in a 2-bit bitfield. Audit users
2709
- // when adding enumerators.
2710
2749
};
2711
2750
2712
2751
struct BridgedRequirementRepr {
2713
2752
BridgedSourceLoc SeparatorLoc;
2714
2753
BridgedRequirementReprKind Kind;
2715
2754
BridgedTypeRepr FirstType;
2716
- BridgedTypeRepr SecondType;
2717
- // FIXME: Handle Layout Requirements
2718
- } ;
2755
+ BridgedNullableTypeRepr SecondType;
2756
+ BridgedLayoutConstraint LayoutConstraint;
2757
+ BridgedSourceLoc LayoutConstraintLoc ;
2719
2758
2720
- enum ENUM_EXTENSIBILITY_ATTR (open) BridgedMacroDefinitionKind : size_t {
2721
- // / An expanded macro.
2722
- BridgedExpandedMacro = 0 ,
2723
- // / An external macro, spelled with either the old spelling (Module.Type)
2724
- // / or the new spelling `#externalMacro(module: "Module", type: "Type")`.
2725
- BridgedExternalMacro,
2726
- // / The builtin definition for "externalMacro".
2727
- BridgedBuiltinExternalMacro,
2728
- // / The builtin definition for the "isolation" macro.
2729
- BridgedBuiltinIsolationMacro,
2759
+ // TODO: bool IsExpansionPattern;
2760
+
2761
+ swift::RequirementRepr unbridged () const ;
2730
2762
};
2731
2763
2764
+ SWIFT_NAME (
2765
+ " BridgedRequirementRepr.createTypeConstraint(subject:colonLoc:constraint:)" )
2766
+ BridgedRequirementRepr
2767
+ BridgedRequirementRepr_createTypeConstraint(BridgedTypeRepr cSubject,
2768
+ BridgedSourceLoc cColonLoc,
2769
+ BridgedTypeRepr cConstraint);
2770
+ SWIFT_NAME (
2771
+ " BridgedRequirementRepr.createSameType(firstType:equalLoc:secondType:)" )
2772
+ BridgedRequirementRepr
2773
+ BridgedRequirementRepr_createSameType(BridgedTypeRepr cFirstType,
2774
+ BridgedSourceLoc cEqualLoc,
2775
+ BridgedTypeRepr cSecondType);
2776
+ SWIFT_NAME (" BridgedRequirementRepr.createLayoutConstraint(subject:colonLoc:"
2777
+ " layout:layoutLoc:)" )
2778
+ BridgedRequirementRepr BridgedRequirementRepr_createLayoutConstraint(
2779
+ BridgedTypeRepr cSubject, BridgedSourceLoc cColonLoc,
2780
+ BridgedLayoutConstraint cLayout, BridgedSourceLoc cLayoutLoc);
2781
+
2732
2782
enum ENUM_EXTENSIBILITY_ATTR (closed) BridgedGenericTypeParamKind : size_t {
2733
2783
// / A regular generic type parameter: 'T'
2734
2784
BridgedGenericTypeParamKindType = 0 ,
@@ -2775,6 +2825,33 @@ SWIFT_NAME("BridgedParameterList.get(self:_:)")
2775
2825
BridgedParamDecl BridgedParameterList_get(BridgedParameterList cParameterList,
2776
2826
size_t i);
2777
2827
2828
+ // ===----------------------------------------------------------------------===//
2829
+ // MARK: Misc
2830
+ // ===----------------------------------------------------------------------===//
2831
+
2832
+ struct BridgedTupleTypeElement {
2833
+ BridgedIdentifier Name;
2834
+ BridgedSourceLoc NameLoc;
2835
+ BridgedIdentifier SecondName;
2836
+ BridgedSourceLoc SecondNameLoc;
2837
+ BridgedSourceLoc UnderscoreLoc;
2838
+ BridgedSourceLoc ColonLoc;
2839
+ BridgedTypeRepr Type;
2840
+ BridgedSourceLoc TrailingCommaLoc;
2841
+ };
2842
+
2843
+ enum ENUM_EXTENSIBILITY_ATTR (open) BridgedMacroDefinitionKind : size_t {
2844
+ // / An expanded macro.
2845
+ BridgedExpandedMacro = 0 ,
2846
+ // / An external macro, spelled with either the old spelling (Module.Type)
2847
+ // / or the new spelling `#externalMacro(module: "Module", type: "Type")`.
2848
+ BridgedExternalMacro,
2849
+ // / The builtin definition for "externalMacro".
2850
+ BridgedBuiltinExternalMacro,
2851
+ // / The builtin definition for the "isolation" macro.
2852
+ BridgedBuiltinIsolationMacro,
2853
+ };
2854
+
2778
2855
struct BridgedASTType {
2779
2856
swift::TypeBase * _Nullable type;
2780
2857
0 commit comments