Skip to content

Commit cde94f6

Browse files
committed
[AST] Eliminate the HasValidatedLayout bit.
We handle layout through finalization of the declaration, which already has its own approach to eliminating redundant work. We don’t need an extra bit getting in the way.
1 parent 9b88853 commit cde94f6

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

include/swift/AST/Decl.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -480,17 +480,13 @@ class alignas(1 << DeclAlignInBits) Decl {
480480
IsDebuggerAlias : 1
481481
);
482482

483-
SWIFT_INLINE_BITFIELD(NominalTypeDecl, GenericTypeDecl, 1+1+1,
483+
SWIFT_INLINE_BITFIELD(NominalTypeDecl, GenericTypeDecl, 1+1,
484484
/// Whether we have already added implicitly-defined initializers
485485
/// to this declaration.
486486
AddedImplicitInitializers : 1,
487487

488488
/// Whether there is are lazily-loaded conformances for this nominal type.
489-
HasLazyConformances : 1,
490-
491-
/// Whether we have already validated all members of the type that
492-
/// affect layout.
493-
HasValidatedLayout : 1
489+
HasLazyConformances : 1
494490
);
495491

496492
SWIFT_INLINE_BITFIELD_FULL(ProtocolDecl, NominalTypeDecl, 1+1+1+1+1+1+1+1+2+8+16,
@@ -3036,7 +3032,6 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
30363032
Bits.NominalTypeDecl.AddedImplicitInitializers = false;
30373033
ExtensionGeneration = 0;
30383034
Bits.NominalTypeDecl.HasLazyConformances = false;
3039-
Bits.NominalTypeDecl.HasValidatedLayout = false;
30403035
}
30413036

30423037
friend class ProtocolType;
@@ -3074,18 +3069,6 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
30743069
Bits.NominalTypeDecl.AddedImplicitInitializers = true;
30753070
}
30763071

3077-
/// Determine whether we have already validated any members
3078-
/// which affect layout.
3079-
bool hasValidatedLayout() const {
3080-
return Bits.NominalTypeDecl.HasValidatedLayout;
3081-
}
3082-
3083-
/// Note that we have attempted to validate any members
3084-
/// which affect layout.
3085-
void setHasValidatedLayout() {
3086-
Bits.NominalTypeDecl.HasValidatedLayout = true;
3087-
}
3088-
30893072
/// Set the interface type of this nominal type to the metatype of the
30903073
/// declared interface type.
30913074
void computeType();

lib/Sema/TypeCheckDecl.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2723,7 +2723,6 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
27232723

27242724
checkUnsupportedNestedType(ED);
27252725
TC.validateDecl(ED);
2726-
ED->setHasValidatedLayout();
27272726

27282727
{
27292728
// Check for circular inheritance of the raw type.
@@ -2761,7 +2760,6 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
27612760
checkUnsupportedNestedType(SD);
27622761

27632762
TC.validateDecl(SD);
2764-
SD->setHasValidatedLayout();
27652763

27662764
TC.addImplicitConstructors(SD);
27672765

@@ -2891,7 +2889,6 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
28912889

28922890
TC.validateDecl(CD);
28932891
TC.requestSuperclassLayout(CD);
2894-
CD->setHasValidatedLayout();
28952892

28962893
{
28972894
// Check for circular inheritance.
@@ -4649,11 +4646,6 @@ void TypeChecker::requestMemberLayout(ValueDecl *member) {
46494646
}
46504647

46514648
void TypeChecker::requestNominalLayout(NominalTypeDecl *nominalDecl) {
4652-
if (nominalDecl->hasValidatedLayout())
4653-
return;
4654-
4655-
nominalDecl->setHasValidatedLayout();
4656-
46574649
if (isa<SourceFile>(nominalDecl->getModuleScopeContext()))
46584650
DeclsToFinalize.insert(nominalDecl);
46594651
}

0 commit comments

Comments
 (0)