diff options
Diffstat (limited to 'llvm/lib/Support/VirtualFileSystem.cpp')
-rw-r--r-- | llvm/lib/Support/VirtualFileSystem.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index c341170..051dd2a 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -2782,10 +2782,9 @@ void JSONWriter::write(ArrayRef<YAMLVFSEntry> Entries, StringRef RPath = Entry.RPath; if (UseOverlayRelative) { - unsigned OverlayDirLen = OverlayDir.size(); - assert(RPath.substr(0, OverlayDirLen) == OverlayDir && + assert(RPath.starts_with(OverlayDir) && "Overlay dir must be contained in RPath"); - RPath = RPath.slice(OverlayDirLen, RPath.size()); + RPath = RPath.slice(OverlayDir.size(), RPath.size()); } bool IsCurrentDirEmpty = true; @@ -2816,10 +2815,9 @@ void JSONWriter::write(ArrayRef<YAMLVFSEntry> Entries, } StringRef RPath = Entry.RPath; if (UseOverlayRelative) { - unsigned OverlayDirLen = OverlayDir.size(); - assert(RPath.substr(0, OverlayDirLen) == OverlayDir && + assert(RPath.starts_with(OverlayDir) && "Overlay dir must be contained in RPath"); - RPath = RPath.slice(OverlayDirLen, RPath.size()); + RPath = RPath.slice(OverlayDir.size(), RPath.size()); } if (!Entry.IsDirectory) { writeEntry(path::filename(Entry.VPath), RPath); |