Skip to content

Commit 070916f

Browse files
committed
DriverTool: adjust argv[0] scanning for CAS
Ensure that we nativize the path and consider only the filename starting prefix to account for file suffixes (e.g. `.exe` on Windows). This ensures that we properly support other platforms.
1 parent 3e2943f commit 070916f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/DriverTool/swift_cache_tool_main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ class SwiftCacheToolInvocation {
196196
}
197197
// drop swift-frontend executable path and leading `-frontend` from
198198
// command-line.
199-
if (StringRef(FrontendArgs[0]).ends_with("swift-frontend"))
199+
llvm::SmallString<261> path;
200+
llvm::sys::path::native(Twine{FrontendArgs[0]}, path);
201+
if (llvm::sys::path::filename(path).starts_with("swift-frontend"))
200202
FrontendArgs.erase(FrontendArgs.begin());
201203
if (StringRef(FrontendArgs[0]) == "-frontend")
202204
FrontendArgs.erase(FrontendArgs.begin());

0 commit comments

Comments
 (0)