|
| 1 | +//// Automatically Generated From AttributeNodes.swift.gyb. |
| 2 | +//// Do Not Edit Directly! |
| 3 | +//===----------------------------------------------------------------------===// |
| 4 | +// |
| 5 | +// This source file is part of the Swift.org open source project |
| 6 | +// |
| 7 | +// Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors |
| 8 | +// Licensed under Apache License v2.0 with Runtime Library Exception |
| 9 | +// |
| 10 | +// See https://swift.org/LICENSE.txt for license information |
| 11 | +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 12 | +// |
| 13 | +//===----------------------------------------------------------------------===// |
| 14 | + |
| 15 | +public class Attribute { |
| 16 | + public let name: String |
| 17 | + public let swiftName: String? |
| 18 | + |
| 19 | + public init(name: String, swiftName: String? = nil) { |
| 20 | + self.name = name |
| 21 | + self.swiftName = swiftName |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | +public class TypeAttribute: Attribute { |
| 26 | + public init(name: String) { |
| 27 | + super.init(name: name) |
| 28 | + } |
| 29 | +} |
| 30 | + |
| 31 | +public class DeclAttribute: Attribute { |
| 32 | + public let className: String |
| 33 | + public let options: [String] |
| 34 | + public let code: Int |
| 35 | + |
| 36 | + public convenience init(name: String, className: String, options: String..., code: Int, swiftName: String? = nil) { |
| 37 | + self.init(name: name, className: className, options: options, code: code, swiftName: swiftName) |
| 38 | + } |
| 39 | + |
| 40 | + public init(name: String, className: String, options: [String], code: Int, swiftName: String? = nil) { |
| 41 | + self.className = className |
| 42 | + self.options = options |
| 43 | + self.code = code |
| 44 | + super.init(name: name, swiftName: swiftName) |
| 45 | + } |
| 46 | +} |
| 47 | + |
| 48 | +public class SimpleDeclAttribute: DeclAttribute { } |
| 49 | + |
| 50 | +public class ContextualDeclAttribute: DeclAttribute { |
| 51 | + public init(name: String, className: String, options: String..., code: Int) { |
| 52 | + super.init(name: name, className: className, options: options, code: code) |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +public class ContextualSimpleDeclAttribute: SimpleDeclAttribute { |
| 57 | + public init(name: String, className: String, options: String..., code: Int) { |
| 58 | + super.init(name: name, className: className, options: options, code: code) |
| 59 | + } |
| 60 | +} |
| 61 | + |
| 62 | +public class DeclAttributeAlias: Attribute { |
| 63 | + public let className: String |
| 64 | + |
| 65 | + public init(name: String, className: String, swiftName: String? = nil) { |
| 66 | + self.className = className |
| 67 | + super.init(name: name, swiftName: swiftName) |
| 68 | + |
| 69 | + } |
| 70 | +} |
| 71 | + |
| 72 | +public class ContextualDeclAttributeAlias: DeclAttributeAlias { } |
| 73 | + |
| 74 | +public class BuiltinDeclModifier: Attribute { } |
| 75 | + |
| 76 | +// Abstract class aggregations for use in Attr.def. |
| 77 | +let onValue = "OnValue" |
| 78 | +let onTypeAlias = "OnTypeAlias" |
| 79 | +let onEnumElement = "OnEnumElement" |
| 80 | +let onSubscript = "OnSubscript" |
| 81 | +let onVar = "OnVar" |
| 82 | +let onExtension = "OnExtension" |
| 83 | +let onClass = "OnClass" |
| 84 | +let onFunc = "OnFunc" |
| 85 | +let onAccessor = "OnAccessor" |
| 86 | +let onEnum = "OnEnum" |
| 87 | +let onConstructor = "OnConstructor" |
| 88 | +let onStruct = "OnStruct" |
| 89 | +let onImport = "OnImport" |
| 90 | +let onAssociatedType = "OnAssociatedType" |
| 91 | +let onGenericTypeParam = "OnGenericTypeParam" |
| 92 | +let onParam = "OnParam" |
| 93 | +let onNominalType = "OnNominalType" |
| 94 | +let onProtocol = "OnProtocol" |
| 95 | +let onConcreteNominalType = "OnConcreteNominalType" |
| 96 | +let onGenericType = "OnGenericType" |
| 97 | +let onAbstractFunction = "OnAbstractFunction" |
| 98 | +let onOperator = "OnOperator" |
| 99 | +let onAnyDecl = "OnAnyDecl" |
| 100 | + |
| 101 | +// True if multiple instances of this attribute are allowed on a single |
| 102 | +// declaration. |
| 103 | +let allowMultipleAttributes = "AllowMultipleAttributes" |
| 104 | + |
| 105 | +// True if this is a decl modifier - i.e., that it should not be spelled |
| 106 | +// with an @. |
| 107 | +let declModifier = "DeclModifier" |
| 108 | + |
| 109 | +// True if this is a long attribute that should be printed on its own line. |
| 110 | +// |
| 111 | +// Currently has no effect on DeclModifier attributes. |
| 112 | +let longAttribute = "LongAttribute" |
| 113 | + |
| 114 | +// True if this shouldn't be serialized. |
| 115 | +let notSerialized = "NotSerialized" |
| 116 | + |
| 117 | +// True if this attribute is only valid when parsing a .sil file. |
| 118 | +let SILOnly = "SILOnly" |
| 119 | + |
| 120 | +// The attribute should be reported by parser as unknown. |
| 121 | +let rejectByParser = "RejectByParser" |
| 122 | + |
| 123 | +// Whether client code cannot use the attribute. |
| 124 | +let userInaccessible = "UserInaccessible" |
| 125 | + |
| 126 | +// Whether adding this attribute can break API |
| 127 | +let APIBreakingToAdd = "APIBreakingToAdd" |
| 128 | + |
| 129 | +// Whether removing this attribute can break API |
| 130 | +let APIBreakingToRemove = "APIBreakingToRemove" |
| 131 | + |
| 132 | +// Whether adding this attribute can break ABI |
| 133 | +let ABIBreakingToAdd = "ABIBreakingToAdd" |
| 134 | + |
| 135 | +// Whether removing this attribute can break ABI |
| 136 | +let ABIBreakingToRemove = "ABIBreakingToRemove" |
| 137 | + |
| 138 | +// The opposite of APIBreakingToAdd |
| 139 | +let APIStableToAdd = "APIStableToAdd" |
| 140 | + |
| 141 | +// The opposite of APIBreakingToRemove |
| 142 | +let APIStableToRemove = "APIStableToRemove" |
| 143 | + |
| 144 | +// The opposite of ABIBreakingToAdd |
| 145 | +let ABIStableToAdd = "ABIStableToAdd" |
| 146 | + |
| 147 | +// The opposite of ABIBreakingToRemove |
| 148 | +let ABIStableToRemove = "ABIStableToRemove" |
| 149 | + |
| 150 | +// Whether this attribute is only valid when concurrency is enabled. |
| 151 | +let concurrencyOnly = "ConcurrencyOnly" |
| 152 | + |
| 153 | +// Whether this attribute is valid on additional decls in ClangImporter. |
| 154 | +let onAnyClangDecl = "OnAnyClangDecl" |
| 155 | + |
| 156 | +// Type attributes |
| 157 | +public let TYPE_ATTR_KINDS = [ |
| 158 | + TypeAttribute(name: "autoclosure"), |
| 159 | + TypeAttribute(name: "convention"), |
| 160 | + TypeAttribute(name: "noescape"), |
| 161 | + TypeAttribute(name: "escaping"), |
| 162 | + TypeAttribute(name: "differentiable"), |
| 163 | + TypeAttribute(name: "noDerivative"), |
| 164 | + TypeAttribute(name: "async"), |
| 165 | + TypeAttribute(name: "Sendable"), |
| 166 | + TypeAttribute(name: "unchecked"), |
| 167 | + TypeAttribute(name: "_local"), |
| 168 | + TypeAttribute(name: "_noMetadata"), |
| 169 | + |
| 170 | + // Generated interface attributes |
| 171 | + TypeAttribute(name: "_opaqueReturnTypeOf"), |
| 172 | +] |
0 commit comments