File tree Expand file tree Collapse file tree 4 files changed +14
-11
lines changed
branches/swift-5.1-branch-04-24-2019/lib/IRGen Expand file tree Collapse file tree 4 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -1319,4 +1319,4 @@ refs/heads/revert-24065-raj-es-perf-bench: acd6c09b6bd8c5aa922845ee4465bf1333e4f
1319
1319
refs/heads/rxwei-patch-3: d5f349dedfb5fcaf84c5ac788ad33ea47e502d11
1320
1320
refs/heads/rxwei-patch-4: d60ed33a03d398b956e1aa81f37b04d0b1cf101e
1321
1321
refs/heads/rxwei-patch-4-1: b7adfa58fd761906363d280fe323578f61097822
1322
- refs/heads/swift-5.1-branch-04-24-2019: f2d63ef2b2a82a953ad33e48b9fe076fc53efe3c
1322
+ refs/heads/swift-5.1-branch-04-24-2019: cb2fcb6e5624163cc7f7526991eda23e10f195e4
Original file line number Diff line number Diff line change @@ -1149,17 +1149,21 @@ void IRGenerator::addLazyFunction(SILFunction *f) {
1149
1149
DefaultIGMForFunction.insert (std::make_pair (f, CurrentIGM));
1150
1150
}
1151
1151
1152
- bool IRGenerator::hasLazyMetadata (NominalTypeDecl *type) {
1152
+ bool IRGenerator::hasLazyMetadata (TypeDecl *type) {
1153
1153
auto found = HasLazyMetadata.find (type);
1154
1154
if (found != HasLazyMetadata.end ())
1155
1155
return found->second ;
1156
1156
1157
1157
auto canBeLazy = [&]() -> bool {
1158
- if (isa<ClangModuleUnit>(type->getModuleScopeContext ())) {
1159
- return requiresForeignTypeMetadata (type);
1160
- } else if (type->getParentModule () == SIL.getSwiftModule ()) {
1161
- // When compiling with -Onone keep all metadata for the debugger. Even if it
1162
- // is not used by the program itself.
1158
+ if (isa<ClangModuleUnit>(type->getInnermostDeclContext ()
1159
+ ->getModuleScopeContext ())) {
1160
+ if (auto nominal = dyn_cast<NominalTypeDecl>(type)) {
1161
+ return requiresForeignTypeMetadata (nominal);
1162
+ }
1163
+ } else if (type->getInnermostDeclContext ()->getParentModule ()
1164
+ == SIL.getSwiftModule ()) {
1165
+ // When compiling with -Onone keep all metadata for the debugger. Even if
1166
+ // it is not used by the program itself.
1163
1167
if (!Opts.shouldOptimize ())
1164
1168
return false ;
1165
1169
if (Opts.UseJIT )
Original file line number Diff line number Diff line change @@ -882,7 +882,7 @@ void IRGenModule::emitStructDecl(StructDecl *st) {
882
882
void IRGenModule::emitFuncDecl (FuncDecl *fd) {
883
883
// If there's an opaque return type for this function, emit its descriptor.
884
884
if (auto opaque = fd->getOpaqueResultTypeDecl ()) {
885
- if (!IRGen.tryEnableLazyTypeMetadata (opaque))
885
+ if (!IRGen.hasLazyMetadata (opaque))
886
886
emitOpaqueTypeDecl (opaque);
887
887
}
888
888
}
Original file line number Diff line number Diff line change @@ -214,7 +214,7 @@ class IRGenerator {
214
214
bool FinishedEmittingLazyDefinitions = false ;
215
215
216
216
// / A map recording if metadata can be emitted lazily for each nominal type.
217
- llvm::DenseMap<NominalTypeDecl *, bool > HasLazyMetadata;
217
+ llvm::DenseMap<TypeDecl *, bool > HasLazyMetadata;
218
218
219
219
struct LazyTypeGlobalsInfo {
220
220
// / Is there a use of the type metadata?
@@ -356,8 +356,7 @@ class IRGenerator {
356
356
// / Checks if metadata for this type can be emitted lazily. This is true for
357
357
// / non-public types as well as imported types, except for classes and
358
358
// / protocols which are always emitted eagerly.
359
- bool hasLazyMetadata (NominalTypeDecl *type);
360
- bool hasLazyMetadata (OpaqueTypeDecl *type);
359
+ bool hasLazyMetadata (TypeDecl *type);
361
360
362
361
// / Emit everything which is reachable from already emitted IR.
363
362
void emitLazyDefinitions ();
You can’t perform that action at this time.
0 commit comments