From 18a77e4ae383bb93f5db66d968571f229c60d22a Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 25 Apr 2025 08:11:52 -0700 Subject: [PATCH] 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. --- lib/Frontend/DiagnosticVerifier.cpp | 8 +++++--- test/ModuleInterface/BadStdlib.swiftinterface | 3 --- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Frontend/DiagnosticVerifier.cpp b/lib/Frontend/DiagnosticVerifier.cpp index 953c0eb27bb77..473f153e4cb0e 100644 --- a/lib/Frontend/DiagnosticVerifier.cpp +++ b/lib/Frontend/DiagnosticVerifier.cpp @@ -1289,15 +1289,17 @@ bool DiagnosticVerifier::finishProcessing() { SmallVector additionalBufferIDs; for (auto path : AdditionalFilePaths) { - auto bufferID = SM.getIDForBufferIdentifier(path); + llvm::SmallString<261> buffer{path}; + llvm::sys::path::make_preferred(buffer); + auto bufferID = SM.getIDForBufferIdentifier(buffer); if (!bufferID) { // Still need to scan this file for expectations. - auto result = SM.getFileSystem()->getBufferForFile(path); + auto result = SM.getFileSystem()->getBufferForFile(buffer); if (!result) { auto message = SM.GetMessage( SourceLoc(), llvm::SourceMgr::DiagKind::DK_Error, llvm::Twine("unable to open file in '-verify-additional-file ") + - path + "': " + result.getError().message(), {}, {}); + buffer + "': " + result.getError().message(), {}, {}); printDiagnostic(message); Result.HadError |= true; continue; diff --git a/test/ModuleInterface/BadStdlib.swiftinterface b/test/ModuleInterface/BadStdlib.swiftinterface index 9b353dc80a1cd..8f05b5e87dc80 100644 --- a/test/ModuleInterface/BadStdlib.swiftinterface +++ b/test/ModuleInterface/BadStdlib.swiftinterface @@ -14,6 +14,3 @@ import ClangMod public func useHasPointer(_: HasPointer) - -// FIXME: https://github.com/apple/swift/issues/56844 -// UNSUPPORTED: OS=windows-msvc