Skip to content

Commit 2d8b4d1

Browse files
committed
AST: Support ImportDecls in DeclExportabilityVisitor.
Resolves rdar://117438934
1 parent f374a41 commit 2d8b4d1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

include/swift/AST/DeclExportabilityVisitor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class DeclExportabilityVisitor
127127
#define DEFAULT_TO_ACCESS_LEVEL(KIND) \
128128
bool visit##KIND##Decl(const KIND##Decl *D) { \
129129
static_assert(std::is_convertible<KIND##Decl *, ValueDecl *>::value, \
130-
"##KIND##Decl must be a ValueDecl"); \
130+
#KIND "Decl must be a ValueDecl"); \
131131
return false; \
132132
}
133133
DEFAULT_TO_ACCESS_LEVEL(NominalType);
@@ -145,12 +145,11 @@ class DeclExportabilityVisitor
145145
// exportability queries.
146146
#define UNREACHABLE(KIND) \
147147
bool visit##KIND##Decl(const KIND##Decl *D) { \
148-
llvm_unreachable("unexpected decl kind"); \
148+
llvm_unreachable("unexpected " #KIND "Decl"); \
149149
return true; \
150150
}
151151
UNREACHABLE(Module);
152152
UNREACHABLE(TopLevelCode);
153-
UNREACHABLE(Import);
154153
UNREACHABLE(PoundDiagnostic);
155154
UNREACHABLE(Missing);
156155
UNREACHABLE(MissingMember);
@@ -169,6 +168,7 @@ class DeclExportabilityVisitor
169168
#define UNINTERESTING(KIND) \
170169
bool visit##KIND##Decl(const KIND##Decl *D) { return true; }
171170
UNINTERESTING(IfConfig);
171+
UNINTERESTING(Import);
172172
UNINTERESTING(PrecedenceGroup);
173173
UNINTERESTING(EnumCase);
174174
UNINTERESTING(Operator);

test/SILGen/skip-non-exportable-decls.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// RUN: %target-swift-frontend -emit-silgen %s -parse-as-library -module-name Test | %FileCheck %s --check-prefixes=CHECK,CHECK-NO-SKIP
33
// RUN: %target-swift-frontend -emit-silgen %s -parse-as-library -module-name Test -experimental-skip-non-exportable-decls | %FileCheck %s --check-prefixes=CHECK,CHECK-SKIP
44

5+
import Swift
6+
57
// CHECK-NO-SKIP: sil private{{.*}} @$s4Test11privateFunc33_E3F0E1C7B46D05C8067CB98677DE566CLLyyF : $@convention(thin) () -> () {
68
// CHECK-SKIP-NOT: s4Test11privateFunc33_E3F0E1C7B46D05C8067CB98677DE566CLLyyF
79
private func privateFunc() {}

0 commit comments

Comments
 (0)