Skip to content

Commit 526fe57

Browse files
authored
Merge pull request #34554 from drodriguez/android-size-is-int-in-32-bits
[android] Split demangling tests for Android 32/64 bits.
2 parents 5b8e514 + 8962f5c commit 526fe57

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// NOTE: manglings.txt should be kept in sync with the manglings in this file.
2+
3+
// Make sure we are testing the right manglings.
4+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-sil -o - -I %S/../Inputs/custom-modules -use-clang-function-types -module-name tmp -enable-objc-interop | %FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%target-os-%target-cpu --check-prefix=CHECK-%target-ptrsize
5+
6+
// Check that demangling works.
7+
8+
// %t.input: "A ---> B" ==> "A"
9+
// RUN: sed -ne '/--->/s/ *--->.*$//p' < %S/Inputs/manglings-with-clang-types.txt > %t.input
10+
// %t.check: "A ---> B" ==> "B"
11+
// RUN: sed -ne '/--->/s/^.*---> *//p' < %S/Inputs/manglings-with-clang-types.txt > %t.check
12+
// RUN: swift-demangle -classify < %t.input > %t.output
13+
// RUN: diff %t.check %t.output
14+
15+
// REQUIRES: OS=linux-android || OS=linux-androideabi
16+
17+
import ctypes
18+
19+
public func f(_ k: @convention(c, cType: "size_t (*)(void)") () -> Int) {
20+
let _ = k()
21+
}
22+
f(ctypes.returns_size_t) // OK: check that importing preserves Clang type
23+
24+
// CHECK-32: sil @$s3tmp1fyySiyXzC9_ZTSPFjvEF
25+
// CHECK-64: sil @$s3tmp1fyySiyXzC9_ZTSPFmvEF
26+

test/Demangle/clang-function-types.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// check that here again.
1717

1818
// UNSUPPORTED: OS=windows-msvc
19+
// UNSUPPORTED: OS=linux-android, OS=linux-androideabi
1920

2021
import ctypes
2122

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-sil -swift-version 5 -use-clang-function-types -experimental-print-full-convention -o - | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
2+
3+
// REQUIRES: OS=linux-android || OS=linux-androideabi
4+
5+
import ctypes
6+
7+
public func f(g: @convention(c, cType: "void (*)(size_t)") (Int) -> ()) { g(0) }
8+
9+
// CHECK-32: sil @$s4main1f1gyySiXzC9_ZTSPFvjE_tF : $@convention(thin) (@convention(c, cType: "void (*)(unsigned int)") @noescape (Int) -> ()) -> () {
10+
// CHECK-32: bb0(%0 : $@convention(c, cType: "void (*)(unsigned int)") @noescape (Int) -> ()):
11+
// CHECK-32: debug_value %0 : $@convention(c, cType: "void (*)(unsigned int)") @noescape (Int) -> (), let, name "g", argno 1 // id: %1
12+
13+
// CHECK-64: sil @$s4main1f1gyySiXzC9_ZTSPFvmE_tF : $@convention(thin) (@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> ()) -> () {
14+
// CHECK-64: bb0(%0 : $@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> ()):
15+
// CHECK-64: debug_value %0 : $@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> (), let, name "g", argno 1 // id: %1

test/SIL/clang-function-types-nonwindows.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) %s -emit-sil -swift-version 5 -use-clang-function-types -experimental-print-full-convention -o - | %FileCheck %s
22

33
// UNSUPPORTED: OS=windows-msvc
4+
// UNSUPPORTED: OS=linux-android, OS=linux-androideabi
45

56
import ctypes
67

0 commit comments

Comments
 (0)