[lld] r205376 - Remove unused enum Position::ANY and third parameter of insertElementAt().
Rui Ueyama
ruiu at google.com
Tue Apr 1 16:58:17 PDT 2014
Author: ruiu
Date: Tue Apr 1 18:58:17 2014
New Revision: 205376
URL: http://llvm.org/viewvc/llvm-project?rev=205376&view=rev
Log:
Remove unused enum Position::ANY and third parameter of insertElementAt().
insertElementAt()'s third parameter is not only unused but also ignored
if you pass Position::END. The actual meaning of the parameter was obscure.
Differential Revision: http://llvm-reviews.chandlerc.com/D3256
Modified:
lld/trunk/include/lld/Core/InputGraph.h
lld/trunk/lib/Core/InputGraph.cpp
Modified: lld/trunk/include/lld/Core/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputGraph.h?rev=205376&r1=205375&r2=205376&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputGraph.h (original)
+++ lld/trunk/include/lld/Core/InputGraph.h Tue Apr 1 18:58:17 2014
@@ -49,11 +49,7 @@ public:
/// Where do we want to insert the input element when calling the
/// insertElementAt.
- enum Position : uint8_t {
- ANY,
- BEGIN,
- END
- };
+ enum Position : uint8_t { BEGIN, END };
/// \brief Initialize the inputgraph
InputGraph() : _ordinal(0), _nextElementIndex(0) {}
@@ -91,8 +87,7 @@ public:
}
/// \brief Insert an element into the input graph at position.
- void insertElementAt(std::unique_ptr<InputElement>, Position position,
- size_t pos = 0);
+ void insertElementAt(std::unique_ptr<InputElement>, Position position);
/// \brief Helper functions for the resolver
ErrorOr<InputElement *> getNextInputElement();
Modified: lld/trunk/lib/Core/InputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/InputGraph.cpp?rev=205376&r1=205375&r2=205376&view=diff
==============================================================================
--- lld/trunk/lib/Core/InputGraph.cpp (original)
+++ lld/trunk/lib/Core/InputGraph.cpp Tue Apr 1 18:58:17 2014
@@ -44,12 +44,13 @@ bool InputGraph::dump(raw_ostream &diagn
/// \brief Insert element at position
void InputGraph::insertElementAt(std::unique_ptr<InputElement> element,
- Position position, size_t pos) {
- if (position == InputGraph::Position::BEGIN)
- pos = 0;
- else if (position == InputGraph::Position::END)
- pos = _inputArgs.size();
- _inputArgs.insert(_inputArgs.begin() + pos, std::move(element));
+ Position position) {
+ if (position == InputGraph::Position::BEGIN) {
+ _inputArgs.insert(_inputArgs.begin(), std::move(element));
+ return;
+ }
+ assert(position == InputGraph::Position::END);
+ _inputArgs.push_back(std::move(element));
}
/// \brief Helper functions for the resolver
More information about the llvm-commits
mailing list