Skip to content

Commit 3d2056d

Browse files
committed
Revert "Sema: Targeted fix for LLDB REPL issue"
Test failing: Swift.IDE.print_ast_tc_decls.swift Swift.attr.attr_objc.swift Swift.attr.attr_objc_clang.swift This reverts commit 1a640d4.
1 parent ae3dc8d commit 3d2056d

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

lib/AST/Decl.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,10 +1857,6 @@ bool NominalTypeDecl::hasFixedLayout() const {
18571857
return true;
18581858
}
18591859

1860-
// Objective-C enums always have a fixed layout.
1861-
if (isa<EnumDecl>(this) && isObjC())
1862-
return true;
1863-
18641860
// Otherwise, access via indirect "resilient" interfaces.
18651861
return false;
18661862
}

lib/Sema/TypeCheckDecl.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6957,17 +6957,18 @@ static void validateFixedLayoutAttribute(TypeChecker &TC,
69576957
NominalTypeDecl *D) {
69586958
DeclAttributes &Attrs = D->getAttrs();
69596959

6960-
// FIXME: Add a per-module serialized HasFixedLayout flag, instead of
6961-
// giving every decl this attribute.
6962-
6963-
if (Attrs.hasAttribute<FixedLayoutAttr>() ||
6964-
TC.Context.LangOpts.EnableResilience)
6960+
if (Attrs.hasAttribute<FixedLayoutAttr>())
69656961
return;
69666962

69676963
// Since -enable-resilience should not change how we call into
69686964
// existing compiled modules, make all value types @_fixed_layout
69696965
// when the frontend is not run with the -enable-resilience flag.
6970-
Attrs.add(new (TC.Context) FixedLayoutAttr(/*IsImplicit*/ true));
6966+
if (!TC.Context.LangOpts.EnableResilience &&
6967+
D->getFormalAccess() == Accessibility::Public)
6968+
Attrs.add(new (TC.Context) FixedLayoutAttr(/*IsImplicit*/ true));
6969+
// @objc enums are always @_fixed_layout.
6970+
else if (isa<EnumDecl>(D) && D->isObjC())
6971+
Attrs.add(new (TC.Context) FixedLayoutAttr(/*IsImplicit*/ true));
69716972
}
69726973

69736974
static void validateAttributes(TypeChecker &TC, Decl *D) {

test/Serialization/alignment.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// RUN: %target-swift-frontend %s -emit-module -parse-as-library -o %t
44
// RUN: %target-sil-opt -enable-sil-verify-all %t/alignment.swiftmodule -o - | FileCheck %s
55

6-
//CHECK: @_alignment(16) @_fixed_layout struct Foo {
7-
@_alignment(16) @_fixed_layout struct Foo {}
6+
//CHECK: @_alignment(16) struct Foo {
7+
@_alignment(16) struct Foo {}
88

99
func foo(x: Foo) {}
1010

0 commit comments

Comments
 (0)