Skip to content

Commit 57872b1

Browse files
committed
AST: Don't print @_originallyDefinedIn with same mangling module name
It doesn't change anything about how we interpret the interface.
1 parent 0155b41 commit 57872b1

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

lib/AST/Attr.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,6 +1078,13 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
10781078
}
10791079
break;
10801080
}
1081+
case DeclAttrKind::OriginallyDefinedIn: {
1082+
auto Attr = cast<OriginallyDefinedInAttr>(this);
1083+
auto Name = D->getDeclContext()->getParentModule()->getName().str();
1084+
if (Options.IsForSwiftInterface && Attr->ManglingModuleName == Name)
1085+
return false;
1086+
break;
1087+
}
10811088
default:
10821089
break;
10831090
}

test/IRGen/backward_deploy_nominal.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// RUN: %target-swift-frontend -emit-ir -parse-as-library -parse-stdlib %s -module-name Compatibility59 -module-abi-name Swift | %FileCheck %s --check-prefix=CHECK-SHIM
55
// RUN: %target-swift-frontend -emit-ir -parse-as-library -parse-stdlib %s -module-name Compatibility59 -module-abi-name Swift | %FileCheck %s --check-prefix=ALSO-SHIM
66

7+
// RUN: %target-swift-emit-module-interface(%t/Swift.swiftinterface) %s -parse-as-library -parse-stdlib -module-name Swift
8+
// RUN: %FileCheck %s --check-prefix=CHECK-INTERFACE < %t/Swift.swiftinterface
9+
710
// REQUIRES: OS=macosx
811

912
// Let's just pretend...
@@ -22,3 +25,8 @@ public struct Fridge<Contents> {}
2225
// The compatibility shim does not have any linker directives.
2326
// ALSO-SHIM-NOT: $ld$hide$
2427
// ALSO-SHIM-NOT: $ld$previous$
28+
29+
// There is no @_originallyDefinedIn in the swiftinterface:
30+
// CHECK-INTERFACE-NOT: @_originallyDefinedIn
31+
// CHECK-INTERFACE: @available(macOS 13, *)
32+
// CHECK-INTERFACE-NEXT: public struct Fridge<Contents> {

0 commit comments

Comments
 (0)