[Lldb-commits] [PATCH] D57552: Handle "." in target.source-map in PathMapListing::FindFiles
Zachary Turner via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 1 10:25:13 PST 2019
zturner added inline comments.
================
Comment at: source/Target/PathMappingList.cpp:204
FileSpec &new_spec) const {
if (!m_pairs.empty()) {
+ std::string orig_path = orig_spec.GetPath();
----------------
Can we put some early returns in here?
```
new_spec.Clear();
if (m_pairs.empty())
return;
```
================
Comment at: source/Target/PathMappingList.cpp:207
+
+ if (!orig_path.empty()) {
+ llvm::StringRef orig_ref(orig_path);
----------------
```
if (orig_path.empty())
return;
```
================
Comment at: source/Target/PathMappingList.cpp:208
+ if (!orig_path.empty()) {
+ llvm::StringRef orig_ref(orig_path);
+ bool orig_is_relative = orig_spec.IsRelative();
----------------
I think we can move this declaration inside of the for loop
================
Comment at: source/Target/PathMappingList.cpp:212
const_iterator pos, end = m_pairs.end();
for (pos = m_pairs.begin(); pos != end; ++pos) {
+ llvm::StringRef prefix_ref = pos->first.GetStringRef();
----------------
How about
```
for (const auto &pair : m_pairs) {
}
```
================
Comment at: source/Target/PathMappingList.cpp:232
+ llvm::StringRef orig_remaining = orig_ref;
+ if (orig_remaining.consume_front(prefix_ref)) {
new_spec.SetFile(pos->second.GetCString(), FileSpec::Style::native);
----------------
After moving inside of the for loop, you can just write `if (orig_ref.consume_front(prefix_ref))`
Repository:
rLLDB LLDB
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57552/new/
https://reviews.llvm.org/D57552
More information about the lldb-commits
mailing list