Skip to content

Commit cd41cc8

Browse files
committed
SourceKit: handle Windows paths for request options
Windows paths involve a `:`. Ideally, we would just use `;` as the separator rather than `:`, but for now special case a single character entry as a drive letter.
1 parent ffc9fb3 commit cd41cc8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tools/SourceKit/tools/sourcekitd-test/sourcekitd-test.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,20 @@ static bool setSyntacticMacroExpansions(sourcekitd_object_t req,
430430
StringRef(opt).split(args, ":");
431431
unsigned line, column;
432432

433-
if (args.size() != 3 || args[0].getAsInteger(10, line) ||
433+
if ((args.size() != 3 && !(args.size() == 4 || args[3].size() == 1)) ||
434+
args[0].getAsInteger(10, line) ||
434435
args[1].getAsInteger(10, column)) {
435436
llvm::errs() << "-req-opts should be {line}:{column}:{json-path}";
436437
return true;
437438
}
438439
unsigned offset = resolveFromLineCol(line, column, inputBuf);
439440

440-
auto Buffer = getBufferForFilename(args[2], opts.VFSFiles)->getBuffer();
441+
std::string path;
442+
if (args.size() == 3)
443+
path = args[2];
444+
else
445+
path = (args[2] + Twine(":") + args[3]).str();
446+
auto Buffer = getBufferForFilename(path, opts.VFSFiles)->getBuffer();
441447
char *Err = nullptr;
442448
auto expansion = sourcekitd_request_create_from_yaml(Buffer.data(), &Err);
443449
if (!expansion) {

0 commit comments

Comments
 (0)