Skip to content

Commit 9f6bc90

Browse files
committed
[SourceKit] Accept a file system in SwiftASTManager::getMemoryBuffer
1 parent 04ff291 commit 9f6bc90

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,11 @@ SwiftASTManager::~SwiftASTManager() {
648648
delete &Impl;
649649
}
650650

651-
std::unique_ptr<llvm::MemoryBuffer>
652-
SwiftASTManager::getMemoryBuffer(StringRef Filename, std::string &Error) {
653-
return Impl.getMemoryBuffer(Filename, llvm::vfs::getRealFileSystem(), Error);
651+
std::unique_ptr<llvm::MemoryBuffer> SwiftASTManager::getMemoryBuffer(
652+
StringRef Filename,
653+
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem,
654+
std::string &Error) {
655+
return Impl.getMemoryBuffer(Filename, FileSystem, Error);
654656
}
655657

656658
static FrontendInputsAndOutputs

tools/SourceKit/lib/SwiftLang/SwiftASTManager.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,10 @@ class SwiftASTManager : public std::enable_shared_from_this<SwiftASTManager> {
262262
SourceKitCancellationToken CancellationToken,
263263
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fileSystem);
264264

265-
std::unique_ptr<llvm::MemoryBuffer> getMemoryBuffer(StringRef Filename,
266-
std::string &Error);
265+
std::unique_ptr<llvm::MemoryBuffer>
266+
getMemoryBuffer(StringRef Filename,
267+
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem,
268+
std::string &Error);
267269

268270
bool initCompilerInvocation(swift::CompilerInvocation &Invocation,
269271
ArrayRef<const char *> Args,

tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ void SwiftLangSupport::indexSource(StringRef InputFile,
277277
IndexingConsumer &IdxConsumer,
278278
ArrayRef<const char *> OrigArgs) {
279279
std::string Error;
280-
auto InputBuf = ASTMgr->getMemoryBuffer(InputFile, Error);
280+
auto InputBuf =
281+
ASTMgr->getMemoryBuffer(InputFile, llvm::vfs::getRealFileSystem(), Error);
281282
if (!InputBuf) {
282283
IdxConsumer.failed(Error);
283284
return;

0 commit comments

Comments
 (0)