@@ -549,10 +549,7 @@ class RedirectingFileSystemParser;
549
549
// / 'case-sensitive': <boolean, default=(true for Posix, false for Windows)>
550
550
// / 'use-external-names': <boolean, default=true>
551
551
// / 'overlay-relative': <boolean, default=false>
552
- // / 'fallthrough': <boolean, default=true, deprecated - use 'redirecting-with'
553
- // / instead>
554
- // / 'redirecting-with': <string, one of 'fallthrough', 'fallback', or
555
- // / 'redirect-only', default='fallthrough'>
552
+ // / 'fallthrough': <boolean, default=true>
556
553
// /
557
554
// / Virtual directories that list their contents are represented as
558
555
// / \verbatim
@@ -623,20 +620,6 @@ class RedirectingFileSystem : public vfs::FileSystem {
623
620
enum EntryKind { EK_Directory, EK_DirectoryRemap, EK_File };
624
621
enum NameKind { NK_NotSet, NK_External, NK_Virtual };
625
622
626
- // / The type of redirection to perform.
627
- enum class RedirectKind {
628
- // / Lookup the redirected path first (ie. the one specified in
629
- // / 'external-contents') and if that fails "fallthrough" to a lookup of the
630
- // / originally provided path.
631
- Fallthrough,
632
- // / Lookup the provided path first and if that fails, "fallback" to a
633
- // / lookup of the redirected path.
634
- Fallback,
635
- // / Only lookup the redirected path, do not lookup the originally provided
636
- // / path.
637
- RedirectOnly
638
- };
639
-
640
623
// / A single file or directory in the VFS.
641
624
class Entry {
642
625
EntryKind Kind;
@@ -771,11 +754,17 @@ class RedirectingFileSystem : public vfs::FileSystem {
771
754
friend class RedirectingFSDirIterImpl ;
772
755
friend class RedirectingFileSystemParser ;
773
756
757
+ bool shouldUseExternalFS () const { return IsFallthrough; }
758
+
774
759
// / Canonicalize path by removing ".", "..", "./", components. This is
775
760
// / a VFS request, do not bother about symlinks in the path components
776
761
// / but canonicalize in order to perform the correct entry search.
777
762
std::error_code makeCanonical (SmallVectorImpl<char > &Path) const ;
778
763
764
+ // / Whether to fall back to the external file system when an operation fails
765
+ // / with the given error code on a path associated with the provided Entry.
766
+ bool shouldFallBackToExternalFS (std::error_code EC, Entry *E = nullptr ) const ;
767
+
779
768
// / Get the File status, or error, from the underlying external file system.
780
769
// / This returns the status with the originally requested name, while looking
781
770
// / up the entry using the canonical path.
@@ -828,9 +817,9 @@ class RedirectingFileSystem : public vfs::FileSystem {
828
817
// / names of files. This global value is overridable on a per-file basis.
829
818
bool UseExternalNames = true ;
830
819
831
- // / Determines the lookups to perform, as well as their order. See
832
- // / \c RedirectKind for details .
833
- RedirectKind Redirection = RedirectKind::Fallthrough ;
820
+ // / Whether to attempt a file lookup in external file system after it wasn't
821
+ // / found in VFS .
822
+ bool IsFallthrough = true ;
834
823
// / @}
835
824
836
825
RedirectingFileSystem (IntrusiveRefCntPtr<FileSystem> ExternalFS);
@@ -885,12 +874,8 @@ class RedirectingFileSystem : public vfs::FileSystem {
885
874
886
875
StringRef getExternalContentsPrefixDir () const ;
887
876
888
- // / Sets the redirection kind to \c Fallthrough if true or \c RedirectOnly
889
- // / otherwise. Will removed in the future, use \c setRedirection instead.
890
877
void setFallthrough (bool Fallthrough);
891
878
892
- void setRedirection (RedirectingFileSystem::RedirectKind Kind);
893
-
894
879
std::vector<llvm::StringRef> getRoots () const ;
895
880
896
881
void dump (raw_ostream &OS) const ;
0 commit comments