[SourceKit] Don't realpath the primary file path

If the file didn’t exist on disk, `fileSystem->getRealPath` returns an empty string, which means we can’t find the `InputBuffer` and thsu won’t run solver-based cursor info. There’s no reason to realpath `PrimaryInputPath`, `getMemoryBuffer` already does that.

rdar://120737244
This commit is contained in:
Alex Hoppen
2024-01-21 17:06:09 -08:00
parent 24814c5e9d
commit 8625b3f119
2 changed files with 17 additions and 3 deletions

View File

@@ -2119,11 +2119,9 @@ void SwiftLangSupport::getCursorInfo(
std::shared_ptr<llvm::MemoryBuffer> InputBuffer;
if (InputBufferName.empty() && Length == 0) {
std::string InputFileError;
llvm::SmallString<128> RealInputFilePath;
fileSystem->getRealPath(PrimaryFilePath, RealInputFilePath);
InputBuffer =
std::shared_ptr<llvm::MemoryBuffer>(getASTManager()->getMemoryBuffer(
RealInputFilePath, fileSystem, InputFileError));
PrimaryFilePath, fileSystem, InputFileError));
}
// Receiver is async, so be careful about captured values. This is all