mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Handle TopLevelCodeDecl in DeclExportabilityVisitor.
This commit is contained in:
@@ -149,7 +149,6 @@ public:
|
|||||||
return true; \
|
return true; \
|
||||||
}
|
}
|
||||||
UNREACHABLE(Module);
|
UNREACHABLE(Module);
|
||||||
UNREACHABLE(TopLevelCode);
|
|
||||||
UNREACHABLE(Missing);
|
UNREACHABLE(Missing);
|
||||||
UNREACHABLE(MissingMember);
|
UNREACHABLE(MissingMember);
|
||||||
UNREACHABLE(GenericTypeParam);
|
UNREACHABLE(GenericTypeParam);
|
||||||
@@ -165,6 +164,7 @@ public:
|
|||||||
// context has already been checked.
|
// context has already been checked.
|
||||||
#define UNINTERESTING(KIND) \
|
#define UNINTERESTING(KIND) \
|
||||||
bool visit##KIND##Decl(const KIND##Decl *D) { return true; }
|
bool visit##KIND##Decl(const KIND##Decl *D) { return true; }
|
||||||
|
UNINTERESTING(TopLevelCode);
|
||||||
UNINTERESTING(IfConfig);
|
UNINTERESTING(IfConfig);
|
||||||
UNINTERESTING(Import);
|
UNINTERESTING(Import);
|
||||||
UNINTERESTING(PoundDiagnostic);
|
UNINTERESTING(PoundDiagnostic);
|
||||||
|
|||||||
11
test/SILGen/skip_non_exportable_decls_top_level.swift
Normal file
11
test/SILGen/skip_non_exportable_decls_top_level.swift
Normal 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 }
|
||||||
Reference in New Issue
Block a user