@@ -57,12 +57,12 @@ StringRef swift::getNameOfModule(const ModuleFile *MF) {
57
57
}
58
58
59
59
namespace {
60
- struct OffsetAndKind {
60
+ struct DeclAndOffset {
61
61
const Decl *D;
62
62
uint64_t offset;
63
63
};
64
64
65
- static raw_ostream &operator <<(raw_ostream &os, OffsetAndKind &&pair) {
65
+ static raw_ostream &operator <<(raw_ostream &os, DeclAndOffset &&pair) {
66
66
return os << Decl::getKindName (pair.D ->getKind ())
67
67
<< " Decl @ " << pair.offset ;
68
68
}
@@ -97,13 +97,13 @@ namespace {
97
97
os << " While deserializing " ;
98
98
99
99
if (auto VD = dyn_cast<ValueDecl>(DeclOrOffset.get ())) {
100
- os << " '" << VD->getBaseName () << " ' (" << OffsetAndKind {VD, offset}
100
+ os << " '" << VD->getBaseName () << " ' (" << DeclAndOffset {VD, offset}
101
101
<< " )" ;
102
102
} else if (auto ED = dyn_cast<ExtensionDecl>(DeclOrOffset.get ())) {
103
103
os << " extension of '" << ED->getExtendedType () << " ' ("
104
- << OffsetAndKind {ED, offset} << " )" ;
104
+ << DeclAndOffset {ED, offset} << " )" ;
105
105
} else {
106
- os << OffsetAndKind {DeclOrOffset.get (), offset};
106
+ os << DeclAndOffset {DeclOrOffset.get (), offset};
107
107
}
108
108
}
109
109
os << " in '" << getNameOfModule (MF) << " '\n " ;
@@ -143,14 +143,9 @@ static void skipRecord(llvm::BitstreamCursor &cursor, unsigned recordKind) {
143
143
auto next = cursor.advance (AF_DontPopBlockAtEnd);
144
144
assert (next.Kind == llvm::BitstreamEntry::Record);
145
145
146
- #if NDEBUG
147
- cursor.skipRecord (next.ID );
148
- #else
149
- SmallVector<uint64_t , 64 > scratch;
150
- StringRef blobData;
151
- unsigned kind = cursor.readRecord (next.ID , scratch, &blobData);
146
+ unsigned kind = cursor.skipRecord (next.ID );
152
147
assert (kind == recordKind);
153
- # endif
148
+ ( void )kind;
154
149
}
155
150
156
151
void ModuleFile::fatal (llvm::Error error) {
@@ -182,26 +177,6 @@ void ModuleFile::fatal(llvm::Error error) {
182
177
abort ();
183
178
}
184
179
185
- ModuleFile &ModuleFile::getModuleFileForDelayedActions () {
186
- assert (FileContext && " cannot delay actions before associating with a file" );
187
- ModuleDecl *associatedModule = getAssociatedModule ();
188
-
189
- // Check for the common case.
190
- if (associatedModule->getFiles ().size () == 1 )
191
- return *this ;
192
-
193
- for (FileUnit *file : associatedModule->getFiles ())
194
- if (auto *serialized = dyn_cast<SerializedASTFile>(file))
195
- return serialized->File ;
196
-
197
- llvm_unreachable (" should always have FileContext in the list of files" );
198
- }
199
-
200
- void ModuleFile::finishPendingActions () {
201
- assert (&getModuleFileForDelayedActions () == this &&
202
- " wrong module used for delayed actions" );
203
- }
204
-
205
180
static Optional<swift::AccessorKind>
206
181
getActualAccessorKind (uint8_t raw) {
207
182
switch (serialization::AccessorKind (raw)) {
@@ -883,7 +858,6 @@ GenericSignature *ModuleFile::getGenericSignature(
883
858
// Read the generic signature.
884
859
BCOffsetRAII restoreOffset (DeclTypeCursor);
885
860
DeclTypeCursor.JumpToBit (sigOrOffset);
886
- DeserializingEntityRAII deserializingEntity (*this );
887
861
888
862
// Read the parameter types.
889
863
SmallVector<GenericTypeParamType *, 4 > paramTypes;
@@ -959,7 +933,6 @@ ModuleFile::getGenericSignatureOrEnvironment(
959
933
// Read the generic environment.
960
934
BCOffsetRAII restoreOffset (DeclTypeCursor);
961
935
DeclTypeCursor.JumpToBit (bitOffset);
962
- DeserializingEntityRAII deserializingEntity (*this );
963
936
964
937
SmallVector<GenericTypeParamType *, 4 > paramTypes;
965
938
using namespace decls_block ;
@@ -1067,7 +1040,6 @@ SubstitutionMap ModuleFile::getSubstitutionMap(
1067
1040
// Read the substitution map.
1068
1041
BCOffsetRAII restoreOffset (DeclTypeCursor);
1069
1042
DeclTypeCursor.JumpToBit (substitutionsOrOffset);
1070
- DeserializingEntityRAII deserializingEntity (*this );
1071
1043
1072
1044
// Read the substitution map.
1073
1045
auto entry = DeclTypeCursor.advance (AF_DontPopBlockAtEnd);
@@ -4007,7 +3979,6 @@ ModuleFile::getDeclChecked(DeclID DID) {
4007
3979
BCOffsetRAII restoreOffset (DeclTypeCursor);
4008
3980
DeclTypeCursor.JumpToBit (declOrOffset);
4009
3981
4010
- ModuleFile::DeserializingEntityRAII deserializingEntity (*this );
4011
3982
Expected<Decl *> deserialized =
4012
3983
DeclDeserializer (*this , declOrOffset).getDeclCheckedImpl ();
4013
3984
if (!deserialized)
0 commit comments