File tree Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Original file line number Diff line number Diff line change @@ -2328,7 +2328,11 @@ llvm::DIScope *IRGenDebugInfoImpl::getOrCreateScope(const SILDebugScope *DS) {
2328
2328
// Force the debug info for the function to be emitted, even if it
2329
2329
// is external or has been inlined.
2330
2330
llvm::Function *Fn = nullptr ;
2331
- if (!SILFn->getName ().empty () && !SILFn->isZombie ())
2331
+ // Avoid materializing generic functions in embedded Swift mode.
2332
+ bool genericInEmbedded =
2333
+ IGM.Context .LangOpts .hasFeature (Feature::Embedded) &&
2334
+ SILFn->isGeneric ();
2335
+ if (!SILFn->getName ().empty () && !SILFn->isZombie () && !genericInEmbedded)
2332
2336
Fn = IGM.getAddrOfSILFunction (SILFn, NotForDefinition);
2333
2337
auto *SP = emitFunction (*SILFn, Fn);
2334
2338
Original file line number Diff line number Diff line change
1
+ // RUN: %target-run-simple-swift(-g %S/Inputs/print.swift -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
2
+ // RUN: %target-run-simple-swift(-g -Osize %S/Inputs/print.swift -enable-experimental-feature Embedded -parse-as-library -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop) | %FileCheck %s
3
+
4
+ // REQUIRES: executable_test
5
+ // REQUIRES: optimized_stdlib
6
+ // REQUIRES: VENDOR=apple
7
+ // REQUIRES: OS=macosx
8
+
9
+ struct User {
10
+ let o : BaseClass
11
+ }
12
+
13
+ class BaseClass {
14
+ func foo( ) { }
15
+ }
16
+
17
+ protocol Protocol {
18
+ func protofoo( )
19
+ }
20
+
21
+ class Implementor : Protocol {
22
+ func protofoo( ) { print ( " Implementor.protofoo " ) }
23
+ }
24
+
25
+ class GenericSubClass < P: Protocol > : BaseClass {
26
+ let p : P
27
+
28
+ init ( p: P ) {
29
+ self . p = p
30
+ }
31
+
32
+ override func foo( ) {
33
+ let x = { self . p. protofoo ( ) }
34
+ x ( )
35
+ }
36
+ }
37
+
38
+ @main
39
+ struct Main {
40
+ static func main( ) {
41
+ let p = Implementor ( )
42
+ let o = GenericSubClass ( p: p)
43
+ let user = User ( o: o)
44
+ user. o. foo ( )
45
+ }
46
+ }
47
+
48
+ // CHECK: Implementor.protofoo
49
+
You can’t perform that action at this time.
0 commit comments