Skip to content

Commit f580778

Browse files
committed
More feedback
1 parent e4f4dfc commit f580778

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2695,17 +2695,18 @@ void Serializer::writeDecl(const Decl *D) {
26952695
auto getFilename = [](FileUnit *enclosingFile,
26962696
const ValueDecl *decl) -> StringRef {
26972697
if (auto *SF = dyn_cast<SourceFile>(enclosingFile)) {
2698-
return SF->getFilename();
2698+
return llvm::sys::path::filename(SF->getFilename());
26992699
} else if (auto *LF = dyn_cast<LoadedFile>(enclosingFile)) {
2700-
return LF->getFilenameForPrivateDecl(decl);
2700+
return llvm::sys::path::filename(
2701+
(LF->getFilenameForPrivateDecl(decl)));
27012702
}
27022703
return StringRef();
27032704
};
27042705
// Only if compiled with -enable-private-imports.
27052706
if (M->arePrivateImportsEnabled()) {
27062707
auto filename = getFilename(enclosingFile, value);
27072708
if (!filename.empty()) {
2708-
auto filenameID = addFilename(llvm::sys::path::filename(filename));
2709+
auto filenameID = addFilename(filename);
27092710
FilenameForPrivateLayout::emitRecord(
27102711
Out, ScratchRecord,
27112712
DeclTypeAbbrCodes[FilenameForPrivateLayout::Code], filenameID);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
private struct Base {
2-
private func shouldNotBeVisible() {}
2+
private func bar() {}
33
}

test/Serialization/Inputs/private_import_other_2.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
private struct Base {
22
private func member() {}
3+
private func bar() {}
34
}
45

56
private struct Other {

test/Serialization/private_import.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@
3232
private func foo() {}
3333
}
3434

35-
extension Base {
36-
// This should not cause a failure.
37-
private func shouldNotBeVisible() {}
38-
}
39-
4035
public func unreleated() {}
4136

4237
// This should not conflict with Other from private_import_other_2.swift.
@@ -47,6 +42,8 @@
4742
@_private(sourceFile: "private_import.swift") import client
4843

4944
Base().foo()
45+
// This should not be ambigious.
46+
Base().bar()
5047

5148
unreleated()
5249
#endif

0 commit comments

Comments
 (0)