Skip to content

Commit fecd2b4

Browse files
committed
Don't mangle lifetime dependencies in older runtimes
1 parent 2b28da6 commit fecd2b4

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

include/swift/AST/ASTMangler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ class ASTMangler : public Mangler {
9191
/// a critical role.
9292
bool AllowTypedThrows = true;
9393

94+
/// If enabled, lifetime dependencies can be encoded in the mangled name.
95+
bool AllowLifetimeDependencies = true;
96+
9497
/// If enabled, declarations annotated with @_originallyDefinedIn are mangled
9598
/// as if they're part of their original module. Disabled for debug mangling,
9699
/// because lldb wants to find declarations in the modules they're currently

lib/AST/ASTMangler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,7 +3247,7 @@ void ASTMangler::appendFunctionResultType(
32473247
appendType(resultType, sig, forDecl);
32483248
}
32493249

3250-
if (lifetimeDependence.has_value()) {
3250+
if (AllowLifetimeDependencies && lifetimeDependence.has_value()) {
32513251
appendLifetimeDependence(*lifetimeDependence);
32523252
}
32533253
}
@@ -3302,7 +3302,7 @@ void ASTMangler::appendParameterTypeListElement(
33023302
if (flags.isCompileTimeConst())
33033303
appendOperator("Yt");
33043304

3305-
if (lifetimeDependence) {
3305+
if (AllowLifetimeDependencies && lifetimeDependence) {
33063306
appendLifetimeDependence(*lifetimeDependence);
33073307
}
33083308

lib/IRGen/IRGenMangler.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ IRGenMangler::mangleTypeForReflection(IRGenModule &IGM,
163163
AllowConcurrencyStandardSubstitutions);
164164
llvm::SaveAndRestore<bool> savedIsolatedAny(AllowIsolatedAny);
165165
llvm::SaveAndRestore<bool> savedTypedThrows(AllowTypedThrows);
166+
llvm::SaveAndRestore<bool> savedLifetimeDependencies(AllowLifetimeDependencies);
166167
if (auto runtimeCompatVersion = getSwiftRuntimeCompatibilityVersionForTarget(
167168
ctx.LangOpts.Target)) {
168169

@@ -178,6 +179,7 @@ IRGenMangler::mangleTypeForReflection(IRGenModule &IGM,
178179
if (*runtimeCompatVersion < llvm::VersionTuple(6, 0)) {
179180
AllowIsolatedAny = false;
180181
AllowTypedThrows = false;
182+
AllowLifetimeDependencies = false;
181183
}
182184
}
183185

0 commit comments

Comments
 (0)