Skip to content

Commit e31c7bc

Browse files
committed
Respond to review comments by @gribozavr.
1 parent 9e1fe0c commit e31c7bc

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
inline int bar() {
1+
inline int notCalled() {
22
return 42;
33
}
44

5-
inline int foo() {
6-
return bar();
5+
inline int calledIndirectly() {
6+
return 42;
7+
}
8+
9+
inline int calledDirectly() {
10+
return calledIndirectly();
711
}

test/Interop/Cxx/function/emit-called-function-ir.swift

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Test that Swift emits code for a C++ inline function that is called from
2+
// another C++ inline function, but not directly from Swift code.
3+
//
4+
// We should not, however, emit code for functions that aren't called even
5+
// indirectly from Swift.
6+
7+
// RUN: %empty-directory(%t)
8+
// RUN: %target-swift-frontend %s -I %S/Inputs -enable-cxx-interop -emit-ir -o - | %FileCheck %s
9+
10+
import EmitCalledFunction
11+
12+
// Unfortunately, we have to repeat the CHECK-NOT to express that notCalled()
13+
// should not occur anywhere in the output.
14+
15+
// CHECK-NOT: @_Z9notCalledv
16+
// CHECK-DAG: define linkonce_odr i32 @_Z14calledDirectlyv() #{{[0-9]+}} comdat {
17+
// CHECK-NOT: @_Z9notCalledv
18+
// CHECK-DAG: define linkonce_odr i32 @_Z16calledIndirectlyv() #{{[0-9]+}} comdat {
19+
// CHECK-NOT: @_Z9notCalledv
20+
calledDirectly()

0 commit comments

Comments
 (0)