[lld] r205594 - Use range-based for loop. No functionality change.
Rui Ueyama
ruiu at google.com
Thu Apr 3 17:59:50 PDT 2014
Author: ruiu
Date: Thu Apr 3 19:59:50 2014
New Revision: 205594
URL: http://llvm.org/viewvc/llvm-project?rev=205594&view=rev
Log:
Use range-based for loop. No functionality change.
Modified:
lld/trunk/lib/Core/InputGraph.cpp
Modified: lld/trunk/lib/Core/InputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/InputGraph.cpp?rev=205594&r1=205593&r2=205594&view=diff
==============================================================================
--- lld/trunk/lib/Core/InputGraph.cpp (original)
+++ lld/trunk/lib/Core/InputGraph.cpp Thu Apr 3 19:59:50 2014
@@ -75,24 +75,17 @@ ErrorOr<InputElement *> InputGraph::getN
}
void InputGraph::normalize() {
- auto iterb = _inputArgs.begin();
- auto itere = _inputArgs.end();
- auto currentIter = _inputArgs.begin();
-
- std::vector<std::unique_ptr<InputElement> > _workInputArgs;
- while (iterb != itere) {
- bool expand = (*iterb)->shouldExpand();
- currentIter = iterb++;
- if (expand) {
- _workInputArgs.insert(
- _workInputArgs.end(),
- std::make_move_iterator((*currentIter)->expandElements().begin()),
- std::make_move_iterator((*currentIter)->expandElements().end()));
- } else {
- _workInputArgs.push_back(std::move(*currentIter));
+ std::vector<std::unique_ptr<InputElement>> vec;
+ for (std::unique_ptr<InputElement> &ie : _inputArgs) {
+ if (!ie->shouldExpand()) {
+ vec.push_back(std::move(ie));
+ continue;
}
+ range<InputElementIterT> expanded = ie->expandElements();
+ vec.insert(vec.end(), std::make_move_iterator(expanded.begin()),
+ std::make_move_iterator(expanded.end()));
}
- _inputArgs = std::move(_workInputArgs);
+ _inputArgs = std::move(vec);
}
/// \brief Read the file into _buffer.
More information about the llvm-commits
mailing list