From 5db595015179e5e2db1afb5d8c9c55c0413217ca Mon Sep 17 00:00:00 2001 From: Pawel Bylica Date: Thu, 22 Oct 2015 08:12:15 +0000 Subject: [PATCH] Use range-based for loop in sys::path::append(). NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250999 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/Path.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp index 653a984194a..e5150bcbb7e 100644 --- a/lib/Support/Path.cpp +++ b/lib/Support/Path.cpp @@ -455,17 +455,15 @@ void append(SmallVectorImpl &path, const Twine &a, if (!c.isTriviallyEmpty()) components.push_back(c.toStringRef(c_storage)); if (!d.isTriviallyEmpty()) components.push_back(d.toStringRef(d_storage)); - for (SmallVectorImpl::const_iterator i = components.begin(), - e = components.end(); - i != e; ++i) { + for (auto &component : components) { bool path_has_sep = !path.empty() && is_separator(path[path.size() - 1]); - bool component_has_sep = !i->empty() && is_separator((*i)[0]); - bool is_root_name = has_root_name(*i); + bool component_has_sep = !component.empty() && is_separator(component[0]); + bool is_root_name = has_root_name(component); if (path_has_sep) { // Strip separators from beginning of component. - size_t loc = i->find_first_not_of(separators); - StringRef c = i->substr(loc); + size_t loc = component.find_first_not_of(separators); + StringRef c = component.substr(loc); // Append it. path.append(c.begin(), c.end()); @@ -477,7 +475,7 @@ void append(SmallVectorImpl &path, const Twine &a, path.push_back(preferred_separator); } - path.append(i->begin(), i->end()); + path.append(component.begin(), component.end()); } } -- 2.34.1