Skip to content

Commit 898665d

Browse files
authored
Merge pull request swiftlang#24463 from jckarter/opaque-type-sync
NFC opaque type cleanups
2 parents 6c779bb + 72aa089 commit 898665d

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,18 +1162,19 @@ void IRGenerator::addLazyFunction(SILFunction *f) {
11621162
}
11631163

11641164
bool IRGenerator::hasLazyMetadata(TypeDecl *type) {
1165+
assert(isa<NominalTypeDecl>(type) ||
1166+
isa<OpaqueTypeDecl>(type));
11651167
auto found = HasLazyMetadata.find(type);
11661168
if (found != HasLazyMetadata.end())
11671169
return found->second;
11681170

11691171
auto canBeLazy = [&]() -> bool {
1170-
if (isa<ClangModuleUnit>(type->getInnermostDeclContext()
1171-
->getModuleScopeContext())) {
1172+
auto *dc = type->getDeclContext();
1173+
if (isa<ClangModuleUnit>(dc->getModuleScopeContext())) {
11721174
if (auto nominal = dyn_cast<NominalTypeDecl>(type)) {
11731175
return requiresForeignTypeMetadata(nominal);
11741176
}
1175-
} else if (type->getInnermostDeclContext()->getParentModule()
1176-
== SIL.getSwiftModule()) {
1177+
} else if (dc->getParentModule() == SIL.getSwiftModule()) {
11771178
// When compiling with -Onone keep all metadata for the debugger. Even if
11781179
// it is not used by the program itself.
11791180
if (!Opts.shouldOptimize())

lib/IRGen/IRGenModule.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ class IRGenerator {
243243
/// queued up.
244244
llvm::SmallPtrSet<NominalTypeDecl *, 4> LazilyEmittedFieldMetadata;
245245
struct LazyOpaqueInfo {
246-
bool IsLazy = false;
247246
bool IsDescriptorUsed = false;
248247
bool IsDescriptorEmitted = false;
249248
};

lib/Sema/TypeCheckAccess.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,7 @@ class UsableFromInlineChecker : public AccessControlCheckerBase,
10491049
UNINTERESTING(Var) // Handled at the PatternBinding level.
10501050
UNINTERESTING(Destructor) // Always correct.
10511051
UNINTERESTING(Accessor) // Handled by the Var or Subscript.
1052+
UNINTERESTING(OpaqueType) // Handled by the Var or Subscript.
10521053

10531054
/// If \p PBD declared stored instance properties in a fixed-contents struct,
10541055
/// return said struct.
@@ -1193,11 +1194,6 @@ class UsableFromInlineChecker : public AccessControlCheckerBase,
11931194
});
11941195
}
11951196

1196-
void visitOpaqueTypeDecl(OpaqueTypeDecl *OTD) {
1197-
// TODO(opaque): The constraint class/protocols on the opaque interface, as
1198-
// well as the naming decl for the opaque type, need to be accessible.
1199-
}
1200-
12011197
void visitAssociatedTypeDecl(AssociatedTypeDecl *assocType) {
12021198
// This must stay in sync with diag::associated_type_not_usable_from_inline.
12031199
enum {

0 commit comments

Comments
 (0)