[VFS] Handle empty entries in directory traversal
The VFS YAML files contain empty directory entries to describe that it's returning from a subdirectory before describing new files in the parent. In the future, we should properly sort and write YAML files avoiding such empty dirs and mitigate the extra recurson cost. However, since this is used by previous existing YAMLs, make the traversal work in their presence. rdar://problem/24499339 llvm-svn: 264970
This commit is contained in:
@@ -1358,16 +1358,21 @@ RedirectingFileSystem::lookupPath(sys::path::const_iterator Start,
|
||||
++Start;
|
||||
#endif
|
||||
|
||||
if (CaseSensitive ? !Start->equals(From->getName())
|
||||
: !Start->equals_lower(From->getName()))
|
||||
// failure to match
|
||||
return make_error_code(llvm::errc::no_such_file_or_directory);
|
||||
StringRef FromName = From->getName();
|
||||
|
||||
++Start;
|
||||
// Forward the search to the next component in case this is an empty one.
|
||||
if (!FromName.empty()) {
|
||||
if (CaseSensitive ? !Start->equals(FromName)
|
||||
: !Start->equals_lower(FromName))
|
||||
// failure to match
|
||||
return make_error_code(llvm::errc::no_such_file_or_directory);
|
||||
|
||||
if (Start == End) {
|
||||
// Match!
|
||||
return From;
|
||||
++Start;
|
||||
|
||||
if (Start == End) {
|
||||
// Match!
|
||||
return From;
|
||||
}
|
||||
}
|
||||
|
||||
auto *DE = dyn_cast<RedirectingDirectoryEntry>(From);
|
||||
|
||||
Reference in New Issue
Block a user