@@ -212,8 +212,10 @@ FileManager::getFile(StringRef Filename, bool openFile, bool CacheFailure) {
212212 return llvm::errorToErrorCode (Result.takeError ());
213213}
214214
215- llvm::Expected<FileEntryRef>
216- FileManager::getFileRef (StringRef Filename, bool openFile, bool CacheFailure) {
215+ llvm::Expected<FileEntryRef> FileManager::getFileRef (StringRef Filename,
216+ bool openFile,
217+ bool CacheFailure,
218+ bool IsText) {
217219 ++NumFileLookups;
218220
219221 // See if there is already an entry in the map.
@@ -259,7 +261,7 @@ FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) {
259261 std::unique_ptr<llvm::vfs::File> F;
260262 llvm::vfs::Status Status;
261263 auto statError = getStatValue (InterndFileName, Status, true ,
262- openFile ? &F : nullptr );
264+ openFile ? &F : nullptr , IsText );
263265 if (statError) {
264266 // There's no real file at the given path.
265267 if (CacheFailure)
@@ -531,7 +533,7 @@ void FileManager::fillRealPathName(FileEntry *UFE, llvm::StringRef FileName) {
531533llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
532534FileManager::getBufferForFile (FileEntryRef FE, bool isVolatile,
533535 bool RequiresNullTerminator,
534- std::optional<int64_t > MaybeLimit) {
536+ std::optional<int64_t > MaybeLimit, bool IsText ) {
535537 const FileEntry *Entry = &FE.getFileEntry ();
536538 // If the content is living on the file entry, return a reference to it.
537539 if (Entry->Content )
@@ -558,42 +560,44 @@ FileManager::getBufferForFile(FileEntryRef FE, bool isVolatile,
558560
559561 // Otherwise, open the file.
560562 return getBufferForFileImpl (Filename, FileSize, isVolatile,
561- RequiresNullTerminator);
563+ RequiresNullTerminator, IsText );
562564}
563565
564566llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
565567FileManager::getBufferForFileImpl (StringRef Filename, int64_t FileSize,
566- bool isVolatile,
567- bool RequiresNullTerminator ) const {
568+ bool isVolatile, bool RequiresNullTerminator,
569+ bool IsText ) const {
568570 if (FileSystemOpts.WorkingDir .empty ())
569571 return FS->getBufferForFile (Filename, FileSize, RequiresNullTerminator,
570- isVolatile);
572+ isVolatile, IsText );
571573
572574 SmallString<128 > FilePath (Filename);
573575 FixupRelativePath (FilePath);
574576 return FS->getBufferForFile (FilePath, FileSize, RequiresNullTerminator,
575- isVolatile);
577+ isVolatile, IsText );
576578}
577579
578580// / getStatValue - Get the 'stat' information for the specified path,
579581// / using the cache to accelerate it if possible. This returns true
580582// / if the path points to a virtual file or does not exist, or returns
581583// / false if it's an existent real file. If FileDescriptor is NULL,
582584// / do directory look-up instead of file look-up.
583- std::error_code
584- FileManager::getStatValue (StringRef Path, llvm::vfs::Status &Status,
585- bool isFile, std::unique_ptr<llvm::vfs::File> *F) {
585+ std::error_code FileManager::getStatValue (StringRef Path,
586+ llvm::vfs::Status &Status,
587+ bool isFile,
588+ std::unique_ptr<llvm::vfs::File> *F,
589+ bool IsText) {
586590 // FIXME: FileSystemOpts shouldn't be passed in here, all paths should be
587591 // absolute!
588592 if (FileSystemOpts.WorkingDir .empty ())
589- return FileSystemStatCache::get (Path, Status, isFile, F,
590- StatCache. get (), *FS);
593+ return FileSystemStatCache::get (Path, Status, isFile, F, StatCache. get (),
594+ *FS, IsText );
591595
592596 SmallString<128 > FilePath (Path);
593597 FixupRelativePath (FilePath);
594598
595599 return FileSystemStatCache::get (FilePath.c_str (), Status, isFile, F,
596- StatCache.get (), *FS);
600+ StatCache.get (), *FS, IsText );
597601}
598602
599603std::error_code
0 commit comments