Skip to content

[android] Split demangling tests for Android 32/64 bits. #34554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions test/Demangle/clang-function-types-android.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// NOTE: manglings.txt should be kept in sync with the manglings in this file.

// Make sure we are testing the right manglings.
// 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

// Check that demangling works.

// %t.input: "A ---> B" ==> "A"
// RUN: sed -ne '/--->/s/ *--->.*$//p' < %S/Inputs/manglings-with-clang-types.txt > %t.input
// %t.check: "A ---> B" ==> "B"
// RUN: sed -ne '/--->/s/^.*---> *//p' < %S/Inputs/manglings-with-clang-types.txt > %t.check
// RUN: swift-demangle -classify < %t.input > %t.output
// RUN: diff %t.check %t.output

// REQUIRES: OS=linux-android || OS=linux-androideabi

import ctypes

public func f(_ k: @convention(c, cType: "size_t (*)(void)") () -> Int) {
let _ = k()
}
f(ctypes.returns_size_t) // OK: check that importing preserves Clang type

// CHECK-32: sil @$s3tmp1fyySiyXzC9_ZTSPFjvEF
// CHECK-64: sil @$s3tmp1fyySiyXzC9_ZTSPFmvEF

1 change: 1 addition & 0 deletions test/Demangle/clang-function-types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// check that here again.

// UNSUPPORTED: OS=windows-msvc
// UNSUPPORTED: OS=linux-android, OS=linux-androideabi

import ctypes

Expand Down
15 changes: 15 additions & 0 deletions test/SIL/clang-function-types-android.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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

// REQUIRES: OS=linux-android || OS=linux-androideabi

import ctypes

public func f(g: @convention(c, cType: "void (*)(size_t)") (Int) -> ()) { g(0) }

// CHECK-32: sil @$s4main1f1gyySiXzC9_ZTSPFvjE_tF : $@convention(thin) (@convention(c, cType: "void (*)(unsigned int)") @noescape (Int) -> ()) -> () {
// CHECK-32: bb0(%0 : $@convention(c, cType: "void (*)(unsigned int)") @noescape (Int) -> ()):
// CHECK-32: debug_value %0 : $@convention(c, cType: "void (*)(unsigned int)") @noescape (Int) -> (), let, name "g", argno 1 // id: %1

// CHECK-64: sil @$s4main1f1gyySiXzC9_ZTSPFvmE_tF : $@convention(thin) (@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> ()) -> () {
// CHECK-64: bb0(%0 : $@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> ()):
// CHECK-64: debug_value %0 : $@convention(c, cType: "void (*)(unsigned long)") @noescape (Int) -> (), let, name "g", argno 1 // id: %1
1 change: 1 addition & 0 deletions test/SIL/clang-function-types-nonwindows.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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

// UNSUPPORTED: OS=windows-msvc
// UNSUPPORTED: OS=linux-android, OS=linux-androideabi

import ctypes

Expand Down