@@ -33,6 +33,7 @@ template<typename T> class ArrayRef;
33
33
}
34
34
35
35
namespace swift {
36
+ class AvailabilityDomain ;
36
37
class Argument ;
37
38
class ASTContext ;
38
39
struct ASTNode ;
@@ -65,6 +66,28 @@ class BridgedCanType;
65
66
class BridgedASTContext ;
66
67
struct BridgedSubstitutionMap ;
67
68
class BridgedParameterList ;
69
+ enum BridgedPlatformKind : size_t ;
70
+
71
+ // Forward declare the underlying AST node type for each wrapper.
72
+ namespace swift {
73
+ #define AST_BRIDGING_WRAPPER (Name ) class Name ;
74
+ #include " swift/AST/ASTBridgingWrappers.def"
75
+ } // end namespace swift
76
+
77
+ // Define the bridging wrappers for each AST node.
78
+ #define AST_BRIDGING_WRAPPER (Name ) BRIDGING_WRAPPER_NONNULL(swift::Name, Name)
79
+ #define AST_BRIDGING_WRAPPER_CONST (Name ) \
80
+ BRIDGING_WRAPPER_CONST_NONNULL (swift::Name, Name)
81
+ #include " swift/AST/ASTBridgingWrappers.def"
82
+
83
+ // For nullable nodes, also define a nullable variant.
84
+ #define AST_BRIDGING_WRAPPER_NULLABLE (Name ) \
85
+ BRIDGING_WRAPPER_NULLABLE (swift::Name, Name)
86
+ #define AST_BRIDGING_WRAPPER_CONST_NULLABLE (Name ) \
87
+ BRIDGING_WRAPPER_CONST_NULLABLE (swift::Name, Name)
88
+ #define AST_BRIDGING_WRAPPER_NONNULL (Name )
89
+ #define AST_BRIDGING_WRAPPER_CONST_NONNULL (Name )
90
+ #include " swift/AST/ASTBridgingWrappers.def"
68
91
69
92
// ===----------------------------------------------------------------------===//
70
93
// MARK: Identifier
@@ -282,6 +305,10 @@ SWIFT_NAME("BridgedASTContext.langOptsGetCompilerVersion(self:_:)")
282
305
SwiftInt BridgedASTContext_langOptsGetCompilerVersion(BridgedASTContext cContext,
283
306
SwiftInt* _Nullable * _Nonnull cComponents);
284
307
308
+ SWIFT_NAME (" getter:BridgedASTContext.availabilityMacroMap(self:)" )
309
+ BridgedAvailabilityMacroMap
310
+ BridgedASTContext_getAvailabilityMacroMap(BridgedASTContext cContext);
311
+
285
312
/* Deallocate an array of Swift int values that was allocated in C++. */
286
313
void deallocateIntBuffer (SwiftInt * _Nullable cComponents);
287
314
@@ -354,22 +381,6 @@ struct BridgedASTNode {
354
381
BRIDGED_INLINE swift::ASTNode unbridged () const ;
355
382
};
356
383
357
- // Forward declare the underlying AST node type for each wrapper.
358
- namespace swift {
359
- #define AST_BRIDGING_WRAPPER (Name ) class Name ;
360
- #include " swift/AST/ASTBridgingWrappers.def"
361
- } // end namespace swift
362
-
363
- // Define the bridging wrappers for each AST node.
364
- #define AST_BRIDGING_WRAPPER (Name ) BRIDGING_WRAPPER_NONNULL(swift::Name, Name)
365
- #include " swift/AST/ASTBridgingWrappers.def"
366
-
367
- // For nullable nodes, also define a nullable variant.
368
- #define AST_BRIDGING_WRAPPER_NULLABLE (Name ) \
369
- BRIDGING_WRAPPER_NULLABLE (swift::Name, Name)
370
- #define AST_BRIDGING_WRAPPER_NONNULL (Name )
371
- #include " swift/AST/ASTBridgingWrappers.def"
372
-
373
384
// Declare `.asDecl` on each BridgedXXXDecl type, which upcasts a wrapper for
374
385
// a Decl subclass to a BridgedDecl.
375
386
#define DECL (Id, Parent ) \
@@ -565,6 +576,120 @@ SWIFT_NAME("getter:BridgedClosureExpr.asDeclContext(self:)")
565
576
BridgedDeclContext
566
577
BridgedClosureExpr_asDeclContext(BridgedClosureExpr cClosure);
567
578
579
+ // ===----------------------------------------------------------------------===//
580
+ // MARK: Availability
581
+ // ===----------------------------------------------------------------------===//
582
+
583
+ enum ENUM_EXTENSIBILITY_ATTR (closed) BridgedPlatformKind : size_t {
584
+ BridgedPlatformKind_None,
585
+ #define AVAILABILITY_PLATFORM (X, PrettyName ) BridgedPlatformKind_##X,
586
+ #include " swift/AST/PlatformKinds.def"
587
+ };
588
+
589
+ SWIFT_NAME (" BridgedPlatformKind.init(from:)" )
590
+ BridgedPlatformKind BridgedPlatformKind_fromString(BridgedStringRef cStr);
591
+
592
+ SWIFT_NAME (" BridgedAvailabilityMacroMap.has(self:name:)" )
593
+ bool BridgedAvailabilityMacroMap_hasName(BridgedAvailabilityMacroMap map,
594
+ BridgedStringRef name);
595
+
596
+ SWIFT_NAME (" BridgedAvailabilityMacroMap.has(self:name:version:)" )
597
+ bool BridgedAvailabilityMacroMap_hasNameAndVersion(
598
+ BridgedAvailabilityMacroMap map, BridgedStringRef name,
599
+ BridgedVersionTuple version);
600
+
601
+ SWIFT_NAME (" BridgedAvailabilityMacroMap.get(self:name:version:)" )
602
+ BridgedArrayRef
603
+ BridgedAvailabilityMacroMap_getSpecs(BridgedAvailabilityMacroMap map,
604
+ BridgedStringRef name,
605
+ BridgedVersionTuple version);
606
+
607
+ struct BridgedAvailabilityMacroDefinition {
608
+ BridgedStringRef name;
609
+ BridgedVersionTuple version;
610
+ BridgedArrayRef specs;
611
+ };
612
+
613
+ enum ENUM_EXTENSIBILITY_ATTR (closed) BridgedAvailabilitySpecKind {
614
+ BridgedAvailabilitySpecKindPlatformVersionConstraint,
615
+ BridgedAvailabilitySpecKindOtherPlatform,
616
+ BridgedAvailabilitySpecKindLanguageVersionConstraint,
617
+ BridgedAvailabilitySpecKindPackageDescriptionVersionConstraint,
618
+ };
619
+
620
+ struct BridgedAvailabilityDomain ;
621
+
622
+ SWIFT_NAME (" getter:BridgedAvailabilitySpec.sourceRange(self:)" )
623
+ BridgedSourceRange
624
+ BridgedAvailabilitySpec_getSourceRange(BridgedAvailabilitySpec spec);
625
+
626
+ SWIFT_NAME (" getter:BridgedAvailabilitySpec.domain(self:)" )
627
+ BridgedAvailabilityDomain
628
+ BridgedAvailabilitySpec_getDomain(BridgedAvailabilitySpec spec);
629
+
630
+ SWIFT_NAME (" getter:BridgedAvailabilitySpec.version(self:)" )
631
+ BridgedVersionTuple
632
+ BridgedAvailabilitySpec_getVersion(BridgedAvailabilitySpec spec);
633
+
634
+ SWIFT_NAME (" getter:BridgedAvailabilitySpec.versionRange(self:)" )
635
+ BridgedSourceRange
636
+ BridgedAvailabilitySpec_getVersionRange(BridgedAvailabilitySpec spec);
637
+
638
+ SWIFT_NAME (" BridgedPlatformVersionConstraintAvailabilitySpec.createParsed(_:"
639
+ " platform:platformLoc:version:runtimeVersion:versionRange:)" )
640
+ BridgedPlatformVersionConstraintAvailabilitySpec
641
+ BridgedPlatformVersionConstraintAvailabilitySpec_createParsed(
642
+ BridgedASTContext cContext, BridgedPlatformKind cPlatform,
643
+ BridgedSourceLoc cPlatformLoc, BridgedVersionTuple cVersion,
644
+ BridgedVersionTuple cRuntimeVersion, BridgedSourceRange cVersionSrcRange);
645
+
646
+ SWIFT_NAME (" BridgedPlatformAgnosticVersionConstraintAvailabilitySpec."
647
+ " createParsed(_:kind:nameLoc:version:versionRange:)" )
648
+ BridgedPlatformAgnosticVersionConstraintAvailabilitySpec
649
+ BridgedPlatformAgnosticVersionConstraintAvailabilitySpec_createParsed(
650
+ BridgedASTContext cContext, BridgedAvailabilitySpecKind cKind,
651
+ BridgedSourceLoc cNameLoc, BridgedVersionTuple cVersion,
652
+ BridgedSourceRange cVersionSrcRange);
653
+
654
+ SWIFT_NAME (" BridgedOtherPlatformAvailabilitySpec.createParsed(_:loc:)" )
655
+ BridgedOtherPlatformAvailabilitySpec
656
+ BridgedOtherPlatformAvailabilitySpec_createParsed(BridgedASTContext cContext,
657
+ BridgedSourceLoc cLoc);
658
+
659
+ SWIFT_NAME (" getter:BridgedPlatformVersionConstraintAvailabilitySpec."
660
+ " asAvailabilitySpec(self:)" )
661
+ BridgedAvailabilitySpec
662
+ BridgedPlatformVersionConstraintAvailabilitySpec_asAvailabilitySpec(
663
+ BridgedPlatformVersionConstraintAvailabilitySpec spec);
664
+
665
+ SWIFT_NAME (" getter:BridgedPlatformAgnosticVersionConstraintAvailabilitySpec."
666
+ " asAvailabilitySpec(self:)" )
667
+ BridgedAvailabilitySpec
668
+ BridgedPlatformAgnosticVersionConstraintAvailabilitySpec_asAvailabilitySpec(
669
+ BridgedPlatformAgnosticVersionConstraintAvailabilitySpec spec);
670
+
671
+ SWIFT_NAME (
672
+ " getter:BridgedOtherPlatformAvailabilitySpec.asAvailabilitySpec(self:)" )
673
+ BridgedAvailabilitySpec BridgedOtherPlatformAvailabilitySpec_asAvailabilitySpec(
674
+ BridgedOtherPlatformAvailabilitySpec spec);
675
+
676
+ struct BridgedAvailabilityDomain {
677
+ void *_Nullable opaque;
678
+
679
+ BridgedAvailabilityDomain () : opaque(nullptr ) {};
680
+ BRIDGED_INLINE BridgedAvailabilityDomain (swift::AvailabilityDomain domain);
681
+ BRIDGED_INLINE swift::AvailabilityDomain unbridged () const ;
682
+
683
+ BRIDGED_INLINE static BridgedAvailabilityDomain forUniversal ();
684
+ BRIDGED_INLINE static BridgedAvailabilityDomain
685
+ forPlatform (BridgedPlatformKind platformKind);
686
+ BRIDGED_INLINE static BridgedAvailabilityDomain forSwiftLanguage ();
687
+ BRIDGED_INLINE static BridgedAvailabilityDomain forPackageDescription ();
688
+ BRIDGED_INLINE static BridgedAvailabilityDomain forEmbedded ();
689
+
690
+ bool isNull () const { return opaque == nullptr ; };
691
+ };
692
+
568
693
// ===----------------------------------------------------------------------===//
569
694
// MARK: DeclAttributes
570
695
// ===----------------------------------------------------------------------===//
@@ -581,7 +706,7 @@ BridgedDeclAttrKind BridgedDeclAttrKind_fromString(BridgedStringRef cStr);
581
706
struct BridgedDeclAttributes {
582
707
BridgedNullableDeclAttribute chain;
583
708
584
- BridgedDeclAttributes () : chain(nullptr ){};
709
+ BridgedDeclAttributes () : chain(nullptr ) {};
585
710
586
711
BRIDGED_INLINE BridgedDeclAttributes (swift::DeclAttributes attrs);
587
712
@@ -598,9 +723,43 @@ BridgedDeclAttribute BridgedDeclAttribute_createSimple(
598
723
BridgedSourceLoc cAtLoc, BridgedSourceLoc cNameLoc);
599
724
600
725
SWIFT_NAME (" BridgedABIAttr.createParsed(_:atLoc:range:abiDecl:)" )
601
- BridgedABIAttr BridgedABIAttr_createParsed(
602
- BridgedASTContext cContext, BridgedSourceLoc atLoc,
603
- BridgedSourceRange range, BridgedNullableDecl abiDecl);
726
+ BridgedABIAttr BridgedABIAttr_createParsed(BridgedASTContext cContext,
727
+ BridgedSourceLoc atLoc,
728
+ BridgedSourceRange range,
729
+ BridgedNullableDecl abiDecl);
730
+
731
+ enum ENUM_EXTENSIBILITY_ATTR (closed) BridgedAvailableAttrKind {
732
+ BridgedAvailableAttrKindDefault,
733
+ BridgedAvailableAttrKindDeprecated,
734
+ BridgedAvailableAttrKindUnavailable,
735
+ BridgedAvailableAttrKindNoAsync,
736
+ };
737
+
738
+ SWIFT_NAME (
739
+ " BridgedAvailableAttr.createParsed(_:atLoc:range:domain:domainLoc:kind:message:"
740
+ " renamed:introduced:introducedRange:deprecated:deprecatedRange:"
741
+ " obsoleted:obsoletedRange:)" )
742
+ BridgedAvailableAttr BridgedAvailableAttr_createParsed(
743
+ BridgedASTContext cContext, BridgedSourceLoc cAtLoc,
744
+ BridgedSourceRange cRange, BridgedAvailabilityDomain cDomain, BridgedSourceLoc cDomainLoc,
745
+ BridgedAvailableAttrKind cKind, BridgedStringRef cMessage,
746
+ BridgedStringRef cRenamed, BridgedVersionTuple cIntroduced,
747
+ BridgedSourceRange cIntroducedRange, BridgedVersionTuple cDeprecated,
748
+ BridgedSourceRange cDeprecatedRange, BridgedVersionTuple cObsoleted,
749
+ BridgedSourceRange cObsoletedRange);
750
+
751
+ SWIFT_NAME (
752
+ " BridgedAvailableAttr.createParsed(_:atLoc:range:domainString:domainLoc:kind:message:"
753
+ " renamed:introduced:introducedRange:deprecated:deprecatedRange:"
754
+ " obsoleted:obsoletedRange:)" )
755
+ BridgedAvailableAttr BridgedAvailableAttr_createParsedStr(
756
+ BridgedASTContext cContext, BridgedSourceLoc cAtLoc,
757
+ BridgedSourceRange cRange, BridgedStringRef cDomainString, BridgedSourceLoc cDomainLoc,
758
+ BridgedAvailableAttrKind cKind, BridgedStringRef cMessage,
759
+ BridgedStringRef cRenamed, BridgedVersionTuple cIntroduced,
760
+ BridgedSourceRange cIntroducedRange, BridgedVersionTuple cDeprecated,
761
+ BridgedSourceRange cDeprecatedRange, BridgedVersionTuple cObsoleted,
762
+ BridgedSourceRange cObsoletedRange);
604
763
605
764
enum ENUM_EXTENSIBILITY_ATTR (closed) BridgedExecutionKind {
606
765
BridgedExecutionKindConcurrent,
0 commit comments