16
16
17
17
#include " ConformanceLookupTable.h"
18
18
#include " swift/AST/ASTContext.h"
19
+ #include " swift/AST/ConformanceAttributes.h"
19
20
#include " swift/AST/ConformanceLookup.h"
20
21
#include " swift/AST/Decl.h"
21
22
#include " swift/AST/ExistentialLayout.h"
@@ -148,23 +149,13 @@ void ConformanceLookupTable::destroy() {
148
149
149
150
namespace {
150
151
struct ConformanceConstructionInfo : public Located <ProtocolDecl *> {
151
- // / The location of the "unchecked" attribute, if present.
152
- const SourceLoc uncheckedLoc;
153
-
154
- // / The location of the "preconcurrency" attribute if present.
155
- const SourceLoc preconcurrencyLoc;
156
-
157
- // / The location of the "unsafe" attribute if present.
158
- const SourceLoc unsafeLoc;
152
+ ConformanceAttributes attributes;
159
153
160
154
ConformanceConstructionInfo () { }
161
155
162
156
ConformanceConstructionInfo (ProtocolDecl *item, SourceLoc loc,
163
- SourceLoc uncheckedLoc,
164
- SourceLoc preconcurrencyLoc,
165
- SourceLoc unsafeLoc)
166
- : Located(item, loc), uncheckedLoc(uncheckedLoc),
167
- preconcurrencyLoc (preconcurrencyLoc), unsafeLoc(unsafeLoc) {}
157
+ ConformanceAttributes attributes)
158
+ : Located(item, loc), attributes(attributes) {}
168
159
};
169
160
}
170
161
@@ -220,7 +211,7 @@ void ConformanceLookupTable::forEachInStage(ConformanceStage stage,
220
211
registerProtocolConformances (next, conformances);
221
212
for (auto conf : conformances) {
222
213
protocols.push_back (
223
- {conf->getProtocol (), SourceLoc (), SourceLoc (), SourceLoc (), SourceLoc ()});
214
+ {conf->getProtocol (), SourceLoc (), ConformanceAttributes ()});
224
215
}
225
216
} else if (next->getParentSourceFile () ||
226
217
next->getParentModule ()->isBuiltinModule ()) {
@@ -229,9 +220,7 @@ void ConformanceLookupTable::forEachInStage(ConformanceStage stage,
229
220
for (const auto &found :
230
221
getDirectlyInheritedNominalTypeDecls (next, inverses, anyObject)) {
231
222
if (auto proto = dyn_cast<ProtocolDecl>(found.Item ))
232
- protocols.push_back (
233
- {proto, found.Loc , found.uncheckedLoc ,
234
- found.preconcurrencyLoc , found.unsafeLoc });
223
+ protocols.push_back ({proto, found.Loc , found.attributes });
235
224
}
236
225
}
237
226
@@ -318,10 +307,8 @@ void ConformanceLookupTable::updateLookupTable(NominalTypeDecl *nominal,
318
307
kp.has_value () &&
319
308
" suppressed conformance for non-known protocol!?" );
320
309
if (!found.isSuppressed ) {
321
- addProtocol (proto, found.Loc ,
322
- source.withUncheckedLoc (found.uncheckedLoc )
323
- .withPreconcurrencyLoc (found.preconcurrencyLoc )
324
- .withUnsafeLoc (found.unsafeLoc ));
310
+ addProtocol (
311
+ proto, found.Loc , source.withAttributes (found.attributes ));
325
312
}
326
313
}
327
314
@@ -335,9 +322,7 @@ void ConformanceLookupTable::updateLookupTable(NominalTypeDecl *nominal,
335
322
for (auto locAndProto : protos)
336
323
addProtocol (
337
324
locAndProto.Item , locAndProto.Loc ,
338
- source.withUncheckedLoc (locAndProto.uncheckedLoc )
339
- .withPreconcurrencyLoc (locAndProto.preconcurrencyLoc )
340
- .withUnsafeLoc (locAndProto.unsafeLoc ));
325
+ source.withAttributes (locAndProto.attributes ));
341
326
});
342
327
break ;
343
328
0 commit comments