Skip to content

Commit c2f8622

Browse files
authored
Merge pull request #22657 from slavapestov/read-legacy-type-info-flag-fix
A couple of fixes for legacy type info support
2 parents a2bb947 + e123815 commit c2f8622

File tree

6 files changed

+17
-12
lines changed

6 files changed

+17
-12
lines changed

lib/IRGen/GenType.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,23 +1151,28 @@ TypeConverter::TypeConverter(IRGenModule &IGM)
11511151
if (IGM.IRGen.Opts.EnableResilienceBypass)
11521152
LoweringMode = Mode::CompletelyFragile;
11531153

1154+
const auto &Triple = IGM.Context.LangOpts.Target;
1155+
11541156
// We have a bunch of -parse-stdlib tests that pass a -target in the test
11551157
// suite. To prevent these from failing when the user hasn't build the
11561158
// standard library for that target, we pass -disable-legacy-type-info to
11571159
// disable trying to load the legacy type info.
11581160
if (IGM.IRGen.Opts.DisableLegacyTypeInfo)
11591161
return;
11601162

1161-
auto platformName = getPlatformNameForTriple(IGM.Triple);
1162-
auto archName = getMajorArchitectureName(IGM.Triple);
1163-
1164-
if (!doesPlatformUseLegacyLayouts(platformName, archName))
1165-
return;
1166-
11671163
llvm::SmallString<128> defaultPath;
11681164

11691165
StringRef path = IGM.IRGen.Opts.ReadLegacyTypeInfoPath;
11701166
if (path.empty()) {
1167+
// If the flag was not explicitly specified, look for a file in a
1168+
// platform-specific location, if this platform is known to require
1169+
// one.
1170+
auto platformName = getPlatformNameForTriple(Triple);
1171+
auto archName = swift::getMajorArchitectureName(Triple);
1172+
1173+
if (!doesPlatformUseLegacyLayouts(platformName, archName))
1174+
return;
1175+
11711176
defaultPath.append(IGM.Context.SearchPathOpts.RuntimeLibraryPath);
11721177
llvm::sys::path::append(defaultPath, "layouts-");
11731178
defaultPath.append(archName);

test/IRGen/arm_to_thumb_darwin.sil

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %swift -target armv7-apple-ios7 %s -gnone -emit-ir -o - | %FileCheck %s -check-prefix=IOS
2-
// RUN: %swift -target armv7k-apple-watchos2 %s -gnone -emit-ir -o - | %FileCheck %s -check-prefix=WATCHOS
1+
// RUN: %swift -target armv7-apple-ios7 -disable-legacy-type-info %s -gnone -emit-ir -o - | %FileCheck %s -check-prefix=IOS
2+
// RUN: %swift -target armv7k-apple-watchos2 -disable-legacy-type-info %s -gnone -emit-ir -o - | %FileCheck %s -check-prefix=WATCHOS
33

44
// REQUIRES: CODEGENERATOR=ARM
55

test/IRGen/autorelease_optimized_armv7.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %swift -gnone -O -target armv7-apple-ios7 -emit-assembly %s -o - | %FileCheck %s
1+
// RUN: %swift -gnone -O -target armv7-apple-ios7 -disable-legacy-type-info -emit-assembly %s -o - | %FileCheck %s
22

33
// REQUIRES: CODEGENERATOR=ARM
44

test/IRGen/bridge_object_armv7.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %swift -module-name bridge_object -emit-ir -target armv7-apple-ios8.0 %s | %FileCheck %s
1+
// RUN: %swift -module-name bridge_object -emit-ir -target armv7-apple-ios8.0 -disable-legacy-type-info %s | %FileCheck %s
22

33
// REQUIRES: CODEGENERATOR=ARM
44

test/IRGen/integer_literal.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %swift -target armv7-apple-ios10 -module-name integer_literal %s -gnone -emit-ir | %FileCheck %s
1+
// RUN: %swift -target armv7-apple-ios10 -disable-legacy-type-info -module-name integer_literal %s -gnone -emit-ir | %FileCheck %s
22

33
// REQUIRES: CODEGENERATOR=ARM
44

test/IRGen/ordering_arm.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %swift -target armv7-apple-ios7.1 %s -module-name main -emit-ir -o - | %FileCheck %s
1+
// RUN: %swift -target armv7-apple-ios7.1 -disable-legacy-type-info %s -module-name main -emit-ir -o - | %FileCheck %s
22

33
// REQUIRES: CODEGENERATOR=ARM
44

0 commit comments

Comments
 (0)