|
23 | 23 | #include "swift/AST/AvailabilityRange.h" |
24 | 24 | #include "swift/AST/ConcreteDeclRef.h" |
25 | 25 | #include "swift/AST/DeclNameLoc.h" |
| 26 | +#include "swift/AST/ExportKind.h" |
26 | 27 | #include "swift/AST/Identifier.h" |
27 | 28 | #include "swift/AST/KnownProtocols.h" |
28 | 29 | #include "swift/AST/LifetimeDependence.h" |
@@ -2955,6 +2956,35 @@ enum class NonSendableKind : uint8_t { |
2955 | 2956 | Assumed |
2956 | 2957 | }; |
2957 | 2958 |
|
| 2959 | +/// Specify whether the declaration should be exported as an interface or |
| 2960 | +/// an implementation. |
| 2961 | +class ExportAttr : public DeclAttribute { |
| 2962 | +public: |
| 2963 | + /// How this declaration is exported. |
| 2964 | + const ExportKind exportKind; |
| 2965 | + |
| 2966 | + ExportAttr(SourceLoc atLoc, SourceRange range, ExportKind exportKind, |
| 2967 | + bool implicit = false) |
| 2968 | + : DeclAttribute(DeclAttrKind::Export, atLoc, range, implicit), |
| 2969 | + exportKind(exportKind) {} |
| 2970 | + |
| 2971 | + ExportAttr(ExportKind exportKind, bool implicit = false) |
| 2972 | + : ExportAttr(SourceLoc(), SourceRange(), exportKind, implicit) { } |
| 2973 | + |
| 2974 | + static bool classof(const DeclAttribute *DA) { |
| 2975 | + return DA->getKind() == DeclAttrKind::Export; |
| 2976 | + } |
| 2977 | + |
| 2978 | + /// Create a copy of this attribute. |
| 2979 | + ExportAttr *clone(ASTContext &ctx) const { |
| 2980 | + return new (ctx) ExportAttr(AtLoc, Range, exportKind, isImplicit()); |
| 2981 | + } |
| 2982 | + |
| 2983 | + bool isEquivalent(const ExportAttr *other, Decl *attachedTo) const { |
| 2984 | + return exportKind == other->exportKind; |
| 2985 | + } |
| 2986 | +}; |
| 2987 | + |
2958 | 2988 | /// Marks a declaration as explicitly non-Sendable. |
2959 | 2989 | class NonSendableAttr : public DeclAttribute { |
2960 | 2990 | public: |
|
0 commit comments