Skip to content

Commit f82cf1e

Browse files
authored
Merge pull request #85993 from compnerd/scanning
swift-scan-test: adjust frontend detection for Windows
2 parents ab27537 + 54f5837 commit f82cf1e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/swift-scan-test/swift-scan-test.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "llvm/ADT/StringExtras.h"
2424
#include "llvm/Support/Allocator.h"
2525
#include "llvm/Support/CommandLine.h"
26+
#include "llvm/Support/Path.h"
2627
#include "llvm/Support/StringSaver.h"
2728
#include "llvm/Support/ThreadPool.h"
2829

@@ -264,8 +265,12 @@ static int action_scan_dependency(std::vector<const char *> &Args,
264265

265266
static std::vector<const char *>
266267
createArgs(ArrayRef<std::string> Cmd, StringSaver &Saver, Actions Action) {
267-
if (!Cmd.empty() && StringRef(Cmd.front()).ends_with("swift-frontend"))
268-
Cmd = Cmd.drop_front();
268+
if (!Cmd.empty()) {
269+
llvm::SmallString<261> path;
270+
llvm::sys::path::native(Twine{Cmd.front()}, path);
271+
if (llvm::sys::path::filename(path).starts_with("swift-frontend"))
272+
Cmd = Cmd.drop_front();
273+
}
269274

270275
// Quote all the arguments before passing to scanner. The scanner is currently
271276
// tokenize the command-line again before parsing.

0 commit comments

Comments
 (0)