Skip to content

Commit 061578c

Browse files
committed
Serialization: Handle IfConfigDecls in ExternallyAccessibleDeclVisitor.
1 parent ce58860 commit 061578c

File tree

6 files changed

+22
-8
lines changed

6 files changed

+22
-8
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3413,7 +3413,6 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
34133413
UNREACHABLE(MacroExpansion);
34143414
UNREACHABLE(GenericTypeParam);
34153415
UNREACHABLE(Param);
3416-
UNREACHABLE(IfConfig);
34173416
UNREACHABLE(PrecedenceGroup);
34183417
UNREACHABLE(Operator);
34193418

@@ -3427,6 +3426,7 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
34273426
// context has already been checked.
34283427
#define UNINTERESTING(KIND) \
34293428
bool visit##KIND##Decl(const KIND##Decl *D) { return true; }
3429+
UNINTERESTING(IfConfig);
34303430
UNINTERESTING(EnumCase);
34313431

34323432
#undef UNINTERESTING

test/Inputs/lazy_typecheck.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,13 @@ extension PublicGenericStruct: EmptyPublicProto where T == InternalStructForCons
246246

247247
public typealias PublicStructAlias = PublicStruct
248248
typealias InternalTypeAlias = DoesNotExist // expected-error {{cannot find type 'DoesNotExist' in scope}}
249+
250+
// MARK: - Compiler directives
251+
252+
extension PublicStruct {
253+
#if FLAG
254+
public static func activeMethod() {}
255+
#else
256+
public static func inactiveMethod() -> DoesNotExist {}
257+
#endif
258+
}

test/Inputs/lazy_typecheck_client.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func testPublicStruct() {
3434
let _: Double = s.publicWrappedProperty
3535
let _: Double = s.$publicWrappedProperty.wrappedValue
3636
PublicStruct.publicStaticMethod()
37+
PublicStruct.activeMethod()
3738
}
3839

3940
func testPublicClass() {

test/ModuleInterface/lazy-typecheck.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %empty-directory(%t)
22

3-
// RUN: %target-swift-frontend -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -typecheck -emit-module-interface-path %t/lazy_typecheck.swiftinterface -enable-library-evolution -parse-as-library -package-name Package -experimental-lazy-typecheck
3+
// RUN: %target-swift-frontend -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -typecheck -emit-module-interface-path %t/lazy_typecheck.swiftinterface -enable-library-evolution -parse-as-library -package-name Package -DFLAG -experimental-lazy-typecheck
44
// RUN: %FileCheck %s < %t/lazy_typecheck.swiftinterface
55

66
// RUN: rm -rf %t/*.swiftmodule
@@ -103,6 +103,9 @@
103103
// CHECK: }
104104
// CHECK: #endif
105105
// CHECK: public typealias PublicStructAlias = lazy_typecheck.PublicStruct
106+
// CHECK: extension lazy_typecheck.PublicStruct {
107+
// CHECK: public static func activeMethod()
108+
// CHECK: }
106109
// CHECK: @available(*, unavailable)
107110
// CHECK-NEXT: extension lazy_typecheck.PublicGenericStruct : lazy_typecheck.EmptyPublicProto where T : _ConstraintThatIsNotPartOfTheAPIOfThisLibrary {}
108111
// CHECK: extension lazy_typecheck.PublicStructIndirectlyConformingToPublicProto : lazy_typecheck.PublicProto {}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-frontend -swift-version 5 %S/../Inputs/lazy_typecheck.swift -enable-library-evolution -parse-as-library -package-name Package -typecheck -verify
3-
// RUN: %target-swift-frontend -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -emit-module -emit-module-path %t/lazy_typecheck.swiftmodule -enable-library-evolution -parse-as-library -package-name Package -experimental-lazy-typecheck -experimental-skip-all-function-bodies -experimental-serialize-external-decls-only
2+
// RUN: %target-swift-frontend -swift-version 5 %S/../Inputs/lazy_typecheck.swift -enable-library-evolution -parse-as-library -package-name Package -DFLAG -typecheck -verify
3+
// RUN: %target-swift-frontend -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -emit-module -emit-module-path %t/lazy_typecheck.swiftmodule -enable-library-evolution -parse-as-library -package-name Package -DFLAG -experimental-lazy-typecheck -experimental-skip-all-function-bodies -experimental-serialize-external-decls-only
44

5-
// RUN: %target-swift-frontend -package-name Package -typecheck -verify %S/../Inputs/lazy_typecheck_client.swift -D TEST_PACKAGE -I %t
5+
// RUN: %target-swift-frontend -package-name Package -typecheck -verify %S/../Inputs/lazy_typecheck_client.swift -DFLAG -I %t

test/TBD/lazy-typecheck.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: split-file %s %t
33

4-
// RUN: %target-swift-frontend -target arm64-apple-macosx10.13 -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -emit-module -emit-module-path /dev/null -emit-tbd-path %t/lazy_typecheck.tbd -enable-library-evolution -parse-as-library -package-name Package -experimental-lazy-typecheck -experimental-skip-all-function-bodies -experimental-serialize-external-decls-only
4+
// RUN: %target-swift-frontend -target arm64-apple-macosx10.13 -swift-version 5 %S/../Inputs/lazy_typecheck.swift -module-name lazy_typecheck -emit-module -emit-module-path /dev/null -emit-tbd-path %t/lazy_typecheck.tbd -enable-library-evolution -parse-as-library -package-name Package -DFLAG -experimental-lazy-typecheck -experimental-skip-all-function-bodies -experimental-serialize-external-decls-only
55
// RUN: %llvm-readtapi %t/lazy_typecheck.tbd %t/expected.tbd
66

77
// REQUIRES: OS=macosx
@@ -86,8 +86,8 @@ exports:
8686
'_$s14lazy_typecheck11PublicClassCfD', '_$s14lazy_typecheck11PublicClassCfd',
8787
'_$s14lazy_typecheck11PublicProtoMp', '_$s14lazy_typecheck11PublicProtoP3reqSiyFTj',
8888
'_$s14lazy_typecheck11PublicProtoP3reqSiyFTq', '_$s14lazy_typecheck11PublicProtoTL',
89-
'_$s14lazy_typecheck11packageFuncSiyF', '_$s14lazy_typecheck12PublicStructV12publicMethodSiyF',
90-
'_$s14lazy_typecheck12PublicStructV14publicPropertySivM',
89+
'_$s14lazy_typecheck11packageFuncSiyF', '_$s14lazy_typecheck12PublicStructV12activeMethodyyFZ',
90+
'_$s14lazy_typecheck12PublicStructV12publicMethodSiyF', '_$s14lazy_typecheck12PublicStructV14publicPropertySivM',
9191
'_$s14lazy_typecheck12PublicStructV14publicPropertySivg',
9292
'_$s14lazy_typecheck12PublicStructV14publicPropertySivpMV',
9393
'_$s14lazy_typecheck12PublicStructV14publicPropertySivs',

0 commit comments

Comments
 (0)