ModuleInterface: skip printing the override keyword if the overriden decl is skipped

rdar://80918826
This commit is contained in:
Xi Ge
2021-07-21 16:47:37 -07:00
parent 73797800b4
commit a25d5ec47d
2 changed files with 15 additions and 0 deletions

View File

@@ -747,6 +747,10 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
// implication. Thus we can skip them.
if (auto *VD = dyn_cast<ValueDecl>(D)) {
if (auto *BD = VD->getOverriddenDecl()) {
// If the overriden decl won't be printed, printing override will fail
// the build of the interface file.
if (!Options.shouldPrint(BD))
return false;
if (!BD->hasClangNode() &&
!BD->getFormalAccessScope(VD->getDeclContext(),
/*treatUsableFromInlineAsPublic*/ true)

View File

@@ -0,0 +1,11 @@
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/inputs)
// RUN: %empty-directory(%t/modulecache)
// RUN: echo "public class HideyHole { @_spi(Private) public init() {} }" > %t/Foo.swift
// RUN: echo "public class StashyCache: HideyHole {}" >> %t/Foo.swift
// RUN: %target-swift-frontend -emit-module -emit-module-interface-path %t/inputs/Foo.swiftinterface %t/Foo.swift -module-name Foo
// RUN: %target-swift-frontend -emit-module-path %t/Bar.swiftmodule -enable-library-evolution -enable-objc-interop -disable-objc-attr-requires-foundation-module -module-name Bar %s -I %t/inputs -disable-availability-checking -module-cache-path %t/modulecache
import Foo