Skip to content

Commit 6d1a714

Browse files
committed
[android][test] Fix a handful of tests and disable one CxxToSwiftToCxx bridging test
Also, make the analogous change to swiftlang/swift-driver#1372, which gets the sanitizer tests working on Android again.
1 parent aad2b6e commit 6d1a714

7 files changed

+22
-24
lines changed

lib/Driver/ToolChains.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -1459,9 +1459,11 @@ void ToolChain::getClangLibraryPath(const ArgList &Args,
14591459
getResourceDirPath(LibPath, Args, /*Shared=*/true);
14601460
// Remove platform name.
14611461
llvm::sys::path::remove_filename(LibPath);
1462-
llvm::sys::path::append(LibPath, "clang", "lib",
1463-
T.isOSDarwin() ? "darwin"
1464-
: getPlatformNameForTriple(T));
1462+
auto platformName =
1463+
T.isOSDarwin() ? "darwin" : getPlatformNameForTriple(Triple);
1464+
if (platformName == "android")
1465+
platformName = "linux";
1466+
llvm::sys::path::append(LibPath, "clang", "lib", platformName);
14651467
}
14661468

14671469
/// Get the runtime library link path, which is platform-specific and found

test/IRGen/section.swift

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
// ASM-NOT: .section
5252
// ASM: $s7section3fooyyF:
5353
// ASM-linux-gnu: .section{{.*}}__TEXT,__mysection
54+
// ASM-linux-android: .section{{.*}}__TEXT,__mysection
55+
// ASM-linux-androideabi: .section{{.*}}__TEXT,__mysection
5456
// ASM-NOT: .section
5557
// ASM: $s7section2g0Sivp:
5658
// ASM-NOT: .section

test/Interop/Cxx/class/constructors-copy-irgen-android.swift

+3-7
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ import Constructors
99
import TypeClassification
1010

1111
// ITANIUM_ARM-LABEL: define protected swiftcc void @"$s7MySwift35copyWithUserProvidedCopyConstructorySo03Has{{cdeF0V_ACtACF|efgH0V_ADtADF}}"
12-
// ITANIUM_ARM-SAME: (%TSo30HasUserProvidedCopyConstructorV* {{.*}}[[ARG0:%.*]], %TSo30HasUserProvidedCopyConstructorV* {{.*}}[[ARG1:%.*]], %TSo30HasUserProvidedCopyConstructorV* {{.*}}[[ARG2:%.*]])
13-
// ITANIUM_ARM: [[ARG0_AS_STRUCT:%.*]] = bitcast %TSo30HasUserProvidedCopyConstructorV* [[ARG0]] to %struct.HasUserProvidedCopyConstructor*
14-
// ITANIUM_ARM: [[ARG2_AS_STRUCT:%.*]] = bitcast %TSo30HasUserProvidedCopyConstructorV* [[ARG2]] to %struct.HasUserProvidedCopyConstructor*
15-
// ITANIUM_ARM: call void @_ZN30HasUserProvidedCopyConstructorC2ERKS_(%struct.HasUserProvidedCopyConstructor* [[ARG0_AS_STRUCT]], %struct.HasUserProvidedCopyConstructor* [[ARG2_AS_STRUCT]])
16-
// ITANIUM_ARM: [[ARG1_AS_STRUCT:%.*]] = bitcast %TSo30HasUserProvidedCopyConstructorV* [[ARG1]] to %struct.HasUserProvidedCopyConstructor*
17-
// ITANIUM_ARM: [[ARG2_AS_STRUCT:%.*]] = bitcast %TSo30HasUserProvidedCopyConstructorV* [[ARG2]] to %struct.HasUserProvidedCopyConstructor*
18-
// ITANIUM_ARM: call void @_ZN30HasUserProvidedCopyConstructorC2ERKS_(%struct.HasUserProvidedCopyConstructor* [[ARG1_AS_STRUCT]], %struct.HasUserProvidedCopyConstructor* [[ARG2_AS_STRUCT]])
12+
// ITANIUM_ARM-SAME: (ptr {{.*}}[[ARG0:%.*]], ptr {{.*}}[[ARG1:%.*]], ptr {{.*}}[[ARG2:%.*]])
13+
// ITANIUM_ARM: call void @_ZN30HasUserProvidedCopyConstructorC2ERKS_(ptr [[ARG0]], ptr [[ARG2]])
14+
// ITANIUM_ARM: call void @_ZN30HasUserProvidedCopyConstructorC2ERKS_(ptr [[ARG1]], ptr [[ARG2]])
1915
// ITANIUM_ARM: ret void
2016

2117
public func copyWithUserProvidedCopyConstructor(_ x: HasUserProvidedCopyConstructor)

test/Interop/Cxx/class/constructors-irgen-android.swift

+8-12
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ import Constructors
99
import TypeClassification
1010

1111
public func createHasVirtualBase() -> HasVirtualBase {
12-
// ITANIUM_ARM: define protected swiftcc void @"$s7MySwift20createHasVirtualBaseSo0deF0VyF"(%TSo14HasVirtualBaseV* noalias nocapture sret({{.*}}) %0)
12+
// ITANIUM_ARM: define protected swiftcc void @"$s7MySwift20createHasVirtualBaseSo0deF0VyF"(ptr noalias nocapture sret({{.*}}) %0)
1313
// To verify that the thunk is inlined, make sure there's no intervening
1414
// `define`, i.e. the call to the C++ constructor happens in
1515
// createHasVirtualBase(), not some later function.
1616
// ITANIUM_ARM-NOT: define
1717
// Note `this` return type.
18-
// ITANIUM_ARM: call void @_ZN14HasVirtualBaseC1E7ArgType(%struct.HasVirtualBase* %{{[0-9]+}}, i64 %{{[0-9]+}})
18+
// ITANIUM_ARM: call void @_ZN14HasVirtualBaseC1E7ArgType(ptr %{{[0-9]+}}, i64 %{{[0-9]+}})
1919
return HasVirtualBase(ArgType())
2020
}
2121

2222
public func createImplicitDefaultConstructor() -> ImplicitDefaultConstructor {
2323
// ITANIUM_ARM: define protected swiftcc i32 @"$s7MySwift32createImplicitDefaultConstructorSo0deF0VyF"()
2424
// ITANIUM_ARM-NOT: define
2525
// Note `this` return type.
26-
// ITANIUM_ARM: call void @_ZN26ImplicitDefaultConstructorC2Ev(%struct.ImplicitDefaultConstructor* %{{[0-9]+}})
26+
// ITANIUM_ARM: call void @_ZN26ImplicitDefaultConstructorC2Ev(ptr %{{[0-9]+}})
2727
return ImplicitDefaultConstructor()
2828
}
2929

@@ -32,11 +32,8 @@ public func createStructWithSubobjectCopyConstructorAndValue() {
3232
// ITANIUM_ARM: [[MEMBER:%.*]] = alloca %TSo33StructWithCopyConstructorAndValueV
3333
// ITANIUM_ARM: [[OBJ:%.*]] = alloca %TSo42StructWithSubobjectCopyConstructorAndValueV
3434
// ITANIUM_ARM: [[TMP:%.*]] = alloca %TSo33StructWithCopyConstructorAndValueV
35-
// ITANIUM_ARM: [[MEMBER_AS_STRUCT:%.*]] = bitcast %TSo33StructWithCopyConstructorAndValueV* [[MEMBER]] to %struct.StructWithCopyConstructorAndValue*
36-
// ITANIUM_ARM: call void @_ZN33StructWithCopyConstructorAndValueC2Ev(%struct.StructWithCopyConstructorAndValue* [[MEMBER_AS_STRUCT]])
37-
// ITANIUM_ARM: [[TMP_STRUCT:%.*]] = bitcast %TSo33StructWithCopyConstructorAndValueV* [[TMP]] to %struct.StructWithCopyConstructorAndValue*
38-
// ITANIUM_ARM: [[MEMBER_AS_STRUCT_2:%.*]] = bitcast %TSo33StructWithCopyConstructorAndValueV* [[MEMBER]] to %struct.StructWithCopyConstructorAndValue*
39-
// ITANIUM_ARM: call void @_ZN33StructWithCopyConstructorAndValueC2ERKS_(%struct.StructWithCopyConstructorAndValue* [[TMP_STRUCT]], %struct.StructWithCopyConstructorAndValue* [[MEMBER_AS_STRUCT_2]])
35+
// ITANIUM_ARM: call void @_ZN33StructWithCopyConstructorAndValueC2Ev(ptr [[MEMBER]])
36+
// ITANIUM_ARM: call void @_ZN33StructWithCopyConstructorAndValueC2ERKS_(ptr [[TMP]], ptr [[MEMBER]])
4037
// ITANIUM_ARM: ret void
4138
let member = StructWithCopyConstructorAndValue()
4239
let obj = StructWithSubobjectCopyConstructorAndValue(member: member)
@@ -45,11 +42,10 @@ public func createStructWithSubobjectCopyConstructorAndValue() {
4542
public func createTemplatedConstructor() {
4643
// ITANIUM_ARM-LABEL: define protected swiftcc void @"$s7MySwift26createTemplatedConstructoryyF"()
4744
// ITANIUM_ARM: [[OBJ:%.*]] = alloca %TSo20TemplatedConstructorV
48-
// ITANIUM_ARM: [[IVAL:%.*]] = load i64, i64*
49-
// ITANIUM_ARM: [[OBJ_AS_STRUCT:%.*]] = bitcast %TSo20TemplatedConstructorV* [[OBJ]] to %struct.TemplatedConstructor*
50-
// ITANIUM_ARM: call void @_ZN20TemplatedConstructorC2I7ArgTypeEET_(%struct.TemplatedConstructor* [[OBJ_AS_STRUCT]], i64 [[IVAL]])
45+
// ITANIUM_ARM: [[IVAL:%.*]] = load i64, ptr
46+
// ITANIUM_ARM: call void @_ZN20TemplatedConstructorC2I7ArgTypeEET_(ptr [[OBJ]], i64 [[IVAL]])
5147
// ITANIUM_ARM: ret void
5248

53-
// ITANIUM_ARM-LABEL: define {{.*}}void @_ZN20TemplatedConstructorC2I7ArgTypeEET_(%struct.TemplatedConstructor* {{.*}}, i64 {{.*}})
49+
// ITANIUM_ARM-LABEL: define {{.*}}void @_ZN20TemplatedConstructorC2I7ArgTypeEET_(ptr {{.*}}, i64 {{.*}})
5450
let templated = TemplatedConstructor(ArgType())
5551
}

test/Interop/Cxx/class/copy-move-assignment-irgen.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public func copyAssign() {
2020
// CHECK: call {{void|ptr}} @{{_ZN31NonTrivialCopyAndCopyMoveAssignC1Ev|_ZN31NonTrivialCopyAndCopyMoveAssignC2Ev|"\?\?0NonTrivialCopyAndCopyMoveAssign@@QEAA@XZ"}}(ptr %[[COPY_INSTANCE:.*]])
2121
// CHECK: call {{void|ptr}} @{{_ZN31NonTrivialCopyAndCopyMoveAssignC1Ev|_ZN31NonTrivialCopyAndCopyMoveAssignC2Ev|"\?\?0NonTrivialCopyAndCopyMoveAssign@@QEAA@XZ"}}(ptr %[[COPY_INSTANCE2:.*]])
2222
// CHECK: call {{void|ptr}} @{{_ZN31NonTrivialCopyAndCopyMoveAssignD1Ev|_ZN31NonTrivialCopyAndCopyMoveAssignD2Ev|"\?\?1NonTrivialCopyAndCopyMoveAssign@@QEAA@XZ"}}(ptr %[[COPY_INSTANCE]])
23-
// CHECK: call {{void|ptr}} @{{_ZN31NonTrivialCopyAndCopyMoveAssignC1EOS_|_ZN31NonTrivialCopyAndCopyMoveAssignC2EOS_|_ZN31NonTrivialCopyAndCopyMoveAssignC1ERKS_Tm|_ZN31NonTrivialCopyAndCopyMoveAssignC2ERKS_Tm|"\?\?0NonTrivialCopyAndCopyMoveAssign@@QEAA@AEBU0@@Z"}}(
23+
// CHECK: call {{void|(noundef )?ptr}} @{{_ZN31NonTrivialCopyAndCopyMoveAssignC1EOS_|_ZN31NonTrivialCopyAndCopyMoveAssignC2EOS_|_ZN31NonTrivialCopyAndCopyMoveAssignC1ERKS_Tm|_ZN31NonTrivialCopyAndCopyMoveAssignC2ERKS_Tm|"\?\?0NonTrivialCopyAndCopyMoveAssign@@QEAA@AEBU0@@Z"}}(
2424
// CHECK-SAME: %[[COPY_INSTANCE]],
2525
// CHECK-SAME: ptr
2626
// CHECK-SAME: %[[COPY_INSTANCE2]])

test/Interop/CxxToSwiftToCxx/bridge-cxx-struct-back-to-cxx.swift

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
// RUN: %target-interop-build-clangxx -fsyntax-only -x c++-header %t/full-cxx-swift-cxx-bridging.h -std=gnu++20 -c -fmodules -fcxx-modules -I %t
2222

23+
// XFAIL: OS=linux-android, OS=linux-androideabi
24+
2325
//--- header.h
2426

2527
struct Trivial {

test/Reflection/conformance_descriptors.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
// CHECK: CONFORMANCES:
1515
// CHECK: =============
16-
// CHECK-DAG: 16ConformanceCheck10SomeStructV6${{[0-9a-f]*}}yXZ0c6NestedD06${{[0-9a-f]*}}LLV (ConformanceCheck.SomeStruct.(unknown context at ${{[0-9a-f]*}}).(SomeNestedStruct in ${{[0-9a-f]*}})) : ConformanceCheck.MyProto
16+
// CHECK-DAG: 16ConformanceCheck10SomeStructV{{[56]}}${{[0-9a-f]*}}yXZ0c6NestedD0{{[56]}}${{[0-9a-f]*}}LLV (ConformanceCheck.SomeStruct.(unknown context at ${{[0-9a-f]*}}).(SomeNestedStruct in ${{[0-9a-f]*}})) : ConformanceCheck.MyProto
1717
// CHECK-DAG: 16ConformanceCheck3fooV3barV3bazV3quxV4quuxV5corgeV6graultV6garplyV5waldoV4fredV5plughV5xyzzyV4thudV18SomeConformingTypeV (ConformanceCheck.foo.bar.baz.qux.quux.corge.grault.garply.waldo.fred.plugh.xyzzy.thud.SomeConformingType) : ConformanceCheck.MyProto
1818
// CHECK-DAG: 16ConformanceCheck7StructAV (ConformanceCheck.StructA) : ConformanceCheck.MyProto, Swift.Hashable, Swift.Equatable
1919
// CHECK-DAG: 16ConformanceCheck2E4O (ConformanceCheck.E4) : ConformanceCheck.P1, ConformanceCheck.P2, ConformanceCheck.P3

0 commit comments

Comments
 (0)