[Lldb-commits] [lldb] r353257 - Little more cleanup on https://reviews.llvm.org/D57552

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 5 17:49:40 PST 2019


Thanks Jim!

On Tue, Feb 5, 2019 at 5:27 PM Jim Ingham via lldb-commits <
lldb-commits at lists.llvm.org> wrote:

> Author: jingham
> Date: Tue Feb  5 17:27:45 2019
> New Revision: 353257
>
> URL: http://llvm.org/viewvc/llvm-project?rev=353257&view=rev
> Log:
> 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
>
> Modified:
>     lldb/trunk/source/Target/PathMappingList.cpp
>
> Modified: lldb/trunk/source/Target/PathMappingList.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/PathMappingList.cpp?rev=353257&r1=353256&r2=353257&view=diff
>
> ==============================================================================
> --- lldb/trunk/source/Target/PathMappingList.cpp (original)
> +++ lldb/trunk/source/Target/PathMappingList.cpp Tue Feb  5 17:27:45 2019
> @@ -211,33 +211,32 @@ bool PathMappingList::FindFile(const Fil
>
>    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()) {
> -      // We consider a relative prefix or one of just "." to
> -      // mean "only apply to relative paths".
> -      bool prefix_is_relative = false;
> -
> -      if (prefix_ref == ".") {
> -        prefix_is_relative = true;
> -        // Remove the "." since it will have been removed from the
> -        // FileSpec paths already.
> -        prefix_ref = prefix_ref.drop_front();
> -      } else {
> -        FileSpec prefix_spec(prefix_ref, FileSpec::Style::native);
> -        prefix_is_relative = prefix_spec.IsRelative();
> -      }
> -      if (prefix_is_relative != orig_is_relative)
> -        continue;
> +    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;
> +
> +    if (prefix_ref == ".") {
> +      prefix_is_relative = true;
> +      // Remove the "." since it will have been removed from the
> +      // FileSpec paths already.
> +      prefix_ref = prefix_ref.drop_front();
> +    } else {
> +      FileSpec prefix_spec(prefix_ref, FileSpec::Style::native);
> +      prefix_is_relative = prefix_spec.IsRelative();
> +    }
> +    if (prefix_is_relative != orig_is_relative)
> +      continue;
>
> -      if (orig_ref.consume_front(prefix_ref)) {
> -        new_spec.SetFile(pos->second.GetCString(),
> FileSpec::Style::native);
> -        new_spec.AppendPathComponent(orig_ref);
> -        if (FileSystem::Instance().Exists(new_spec))
> -          return true;
> -      }
> +    if (orig_ref.consume_front(prefix_ref)) {
> +      new_spec.SetFile(entry.second.GetCString(),
> FileSpec::Style::native);
> +      new_spec.AppendPathComponent(orig_ref);
> +      if (FileSystem::Instance().Exists(new_spec))
> +        return true;
>      }
>    }
>
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190205/0ec78d6d/attachment-0001.html>


More information about the lldb-commits mailing list