forked from OSchip/llvm-project
Little more cleanup on https://reviews.llvm.org/D57552
Thanks Jonas... One more early continue and using a range where we had an iterator. NFC llvm-svn: 353257
This commit is contained in:
parent
443c034391
commit
1a377ca4cd
|
@ -211,11 +211,11 @@ bool PathMappingList::FindFile(const FileSpec &orig_spec,
|
|||
|
||||
bool orig_is_relative = orig_spec.IsRelative();
|
||||
|
||||
const_iterator pos, end = m_pairs.end();
|
||||
for (pos = m_pairs.begin(); pos != end; ++pos) {
|
||||
for (auto entry : m_pairs) {
|
||||
llvm::StringRef orig_ref(orig_path);
|
||||
llvm::StringRef prefix_ref = pos->first.GetStringRef();
|
||||
if (orig_ref.size() >= prefix_ref.size()) {
|
||||
llvm::StringRef prefix_ref = entry.first.GetStringRef();
|
||||
if (orig_ref.size() < prefix_ref.size())
|
||||
continue;
|
||||
// We consider a relative prefix or one of just "." to
|
||||
// mean "only apply to relative paths".
|
||||
bool prefix_is_relative = false;
|
||||
|
@ -233,13 +233,12 @@ bool PathMappingList::FindFile(const FileSpec &orig_spec,
|
|||
continue;
|
||||
|
||||
if (orig_ref.consume_front(prefix_ref)) {
|
||||
new_spec.SetFile(pos->second.GetCString(), FileSpec::Style::native);
|
||||
new_spec.SetFile(entry.second.GetCString(), FileSpec::Style::native);
|
||||
new_spec.AppendPathComponent(orig_ref);
|
||||
if (FileSystem::Instance().Exists(new_spec))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
new_spec.Clear();
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue