AST: Handle TopLevelCodeDecl in DeclExportabilityVisitor.

This commit is contained in:
Allan Shortlidge
2023-12-09 22:11:19 -08:00
parent a038f7d8c6
commit 3c68c20ef5
2 changed files with 12 additions and 1 deletions

View File

@@ -149,7 +149,6 @@ public:
return true; \
}
UNREACHABLE(Module);
UNREACHABLE(TopLevelCode);
UNREACHABLE(Missing);
UNREACHABLE(MissingMember);
UNREACHABLE(GenericTypeParam);
@@ -165,6 +164,7 @@ public:
// context has already been checked.
#define UNINTERESTING(KIND) \
bool visit##KIND##Decl(const KIND##Decl *D) { return true; }
UNINTERESTING(TopLevelCode);
UNINTERESTING(IfConfig);
UNINTERESTING(Import);
UNINTERESTING(PoundDiagnostic);

View File

@@ -0,0 +1,11 @@
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-silgen %s -module-name Test | %FileCheck %s --check-prefixes=CHECK,CHECK-NO-SKIP
// RUN: %target-swift-frontend -emit-silgen %s -module-name Test -experimental-skip-non-exportable-decls | %FileCheck %s --check-prefixes=CHECK,CHECK-SKIP
// CHECK-NO-SKIP: sil_global hidden @$s4Test1xSivp : $Int
// CHECK-SKIP: sil_global hidden_external @$s4Test1xSivp : $Int
var x = foo()
// CHECK-NO-SKIP: sil hidden{{.*}} @$s4Test3fooSiyF : $@convention(thin) () -> Int {
// CHECK-SKIP: sil hidden_external @$s4Test3fooSiyF : $@convention(thin) () -> Int
func foo() -> Int { return 1 }