Skip to content

Commit fd9777e

Browse files
authored
Merge pull request #78986 from kubamracek/embedded-api-descriptor
[embedded] Don't emit extensions to API descriptor under Embedded Swift, avoid compiler crash
2 parents f695875 + fcc851b commit fd9777e

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

lib/SIL/IR/SILSymbolVisitor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,9 @@ class SILSymbolVisitorImpl : public ASTVisitor<SILSymbolVisitorImpl> {
741741
if (canSkipNominal(nominal))
742742
return;
743743

744+
if (ED->getASTContext().LangOpts.hasFeature(Feature::Embedded))
745+
return;
746+
744747
if (auto CD = dyn_cast_or_null<ClassDecl>(ED->getImplementedObjCDecl())) {
745748
// @_objcImplementation extensions generate the class metadata symbols.
746749
(void)addClassMetadata(CD);
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// RUN: %target-swift-frontend -emit-ir %s -enable-experimental-feature Embedded -emit-api-descriptor-path %t.json
2+
// RUN: %validate-json %t.json | %FileCheck %s
3+
4+
// REQUIRES: swift_in_compiler
5+
// REQUIRES: optimized_stdlib
6+
// REQUIRES: swift_feature_Embedded
7+
8+
public struct MyStruct {
9+
}
10+
11+
extension MyStruct: Equatable {
12+
public static func == (lhs: Self, rhs: Self) -> Bool { return false }
13+
}
14+
15+
// CHECK: "target"
16+
// CHECK-NEXT: "globals": [
17+
// CHECK-NEXT: {
18+
// CHECK-NEXT: "name": "{{(_main)|(main)}}",
19+
// CHECK-NEXT: "access": "public",
20+
// CHECK-NEXT: "file": "",
21+
// CHECK-NEXT: "linkage": "exported"
22+
// CHECK-NEXT: }
23+
// CHECK-NEXT: ],
24+
// CHECK-NEXT: "interfaces": [],
25+
// CHECK-NEXT: "categories": [],
26+
// CHECK-NEXT: "version": "1.0"

0 commit comments

Comments
 (0)