1616
1717#include " ConformanceLookupTable.h"
1818#include " swift/AST/ASTContext.h"
19+ #include " swift/AST/ConformanceAttributes.h"
1920#include " swift/AST/ConformanceLookup.h"
2021#include " swift/AST/Decl.h"
2122#include " swift/AST/ExistentialLayout.h"
@@ -148,23 +149,13 @@ void ConformanceLookupTable::destroy() {
148149
149150namespace {
150151 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;
159153
160154 ConformanceConstructionInfo () { }
161155
162156 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) {}
168159 };
169160}
170161
@@ -220,7 +211,7 @@ void ConformanceLookupTable::forEachInStage(ConformanceStage stage,
220211 registerProtocolConformances (next, conformances);
221212 for (auto conf : conformances) {
222213 protocols.push_back (
223- {conf->getProtocol (), SourceLoc (), SourceLoc (), SourceLoc (), SourceLoc ()});
214+ {conf->getProtocol (), SourceLoc (), ConformanceAttributes ()});
224215 }
225216 } else if (next->getParentSourceFile () ||
226217 next->getParentModule ()->isBuiltinModule ()) {
@@ -229,9 +220,7 @@ void ConformanceLookupTable::forEachInStage(ConformanceStage stage,
229220 for (const auto &found :
230221 getDirectlyInheritedNominalTypeDecls (next, inverses, anyObject)) {
231222 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 });
235224 }
236225 }
237226
@@ -318,10 +307,8 @@ void ConformanceLookupTable::updateLookupTable(NominalTypeDecl *nominal,
318307 kp.has_value () &&
319308 " suppressed conformance for non-known protocol!?" );
320309 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 ));
325312 }
326313 }
327314
@@ -335,9 +322,7 @@ void ConformanceLookupTable::updateLookupTable(NominalTypeDecl *nominal,
335322 for (auto locAndProto : protos)
336323 addProtocol (
337324 locAndProto.Item , locAndProto.Loc ,
338- source.withUncheckedLoc (locAndProto.uncheckedLoc )
339- .withPreconcurrencyLoc (locAndProto.preconcurrencyLoc )
340- .withUnsafeLoc (locAndProto.unsafeLoc ));
325+ source.withAttributes (locAndProto.attributes ));
341326 });
342327 break ;
343328
0 commit comments