Skip to content

Commit 18a77e4

Browse files
committed
Frontend: use preferred path spellings for paths
Convert paths to the preferred spelling before passing it to the SourceManager to ensure that we have the canonical spelling. This is important as a path with a non-canonical path separator would otherwise fail to be looked up in the source manager buffer.
1 parent 376651d commit 18a77e4

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/Frontend/DiagnosticVerifier.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -1289,15 +1289,17 @@ bool DiagnosticVerifier::finishProcessing() {
12891289

12901290
SmallVector<unsigned, 4> additionalBufferIDs;
12911291
for (auto path : AdditionalFilePaths) {
1292-
auto bufferID = SM.getIDForBufferIdentifier(path);
1292+
llvm::SmallString<261> buffer{path};
1293+
llvm::sys::path::make_preferred(buffer);
1294+
auto bufferID = SM.getIDForBufferIdentifier(buffer);
12931295
if (!bufferID) {
12941296
// Still need to scan this file for expectations.
1295-
auto result = SM.getFileSystem()->getBufferForFile(path);
1297+
auto result = SM.getFileSystem()->getBufferForFile(buffer);
12961298
if (!result) {
12971299
auto message = SM.GetMessage(
12981300
SourceLoc(), llvm::SourceMgr::DiagKind::DK_Error,
12991301
llvm::Twine("unable to open file in '-verify-additional-file ") +
1300-
path + "': " + result.getError().message(), {}, {});
1302+
buffer + "': " + result.getError().message(), {}, {});
13011303
printDiagnostic(message);
13021304
Result.HadError |= true;
13031305
continue;

test/ModuleInterface/BadStdlib.swiftinterface

-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,3 @@
1414
import ClangMod
1515

1616
public func useHasPointer(_: HasPointer)
17-
18-
// FIXME: https://github.com/apple/swift/issues/56844
19-
// UNSUPPORTED: OS=windows-msvc

0 commit comments

Comments
 (0)