[lld] r225769 - Remove dead code.
Rui Ueyama
ruiu at google.com
Mon Jan 12 21:59:18 PST 2015
Author: ruiu
Date: Mon Jan 12 23:59:17 2015
New Revision: 225769
URL: http://llvm.org/viewvc/llvm-project?rev=225769&view=rev
Log:
Remove dead code.
Now every InputElement has exactly one File in it, so "expand"
method is now no-op.
Modified:
lld/trunk/include/lld/Core/InputGraph.h
lld/trunk/lib/Core/InputGraph.cpp
lld/trunk/lib/Driver/Driver.cpp
lld/trunk/unittests/DriverTests/InputGraphTest.cpp
Modified: lld/trunk/include/lld/Core/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputGraph.h?rev=225769&r1=225768&r2=225769&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputGraph.h (original)
+++ lld/trunk/include/lld/Core/InputGraph.h Mon Jan 12 23:59:17 2015
@@ -63,9 +63,6 @@ public:
/// \brief Adds a node at the beginning of the InputGraph
void addInputElementFront(std::unique_ptr<InputElement>);
- /// Normalize the InputGraph. It calls getReplacements() on each element.
- void normalize();
-
InputElementVectorT &inputElements() {
return _inputArgs;
}
@@ -116,11 +113,6 @@ public:
/// Get the next file to be processed by the resolver
virtual File *getNextFile() = 0;
- /// Get the elements that we want to expand with.
- virtual bool getReplacements(InputGraph::InputElementVectorT &) {
- return false;
- }
-
protected:
Kind _kind; // The type of the Element
};
@@ -189,11 +181,10 @@ public:
_files.push_back(std::move(ai));
}
- bool getReplacements(InputGraph::InputElementVectorT &result) override;
-
/// \brief Return the next File thats part of this node to the
/// resolver.
File *getNextFile() override {
+ assert(_files.size() == 1);
if (_nextFileIndex == _files.size())
return nullptr;
return _files[_nextFileIndex++].get();
Modified: lld/trunk/lib/Core/InputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/InputGraph.cpp?rev=225769&r1=225768&r2=225769&view=diff
==============================================================================
--- lld/trunk/lib/Core/InputGraph.cpp (original)
+++ lld/trunk/lib/Core/InputGraph.cpp Mon Jan 12 23:59:17 2015
@@ -49,16 +49,6 @@ InputElement *InputGraph::getNextInputEl
return elem;
}
-void InputGraph::normalize() {
- std::vector<std::unique_ptr<InputElement>> vec;
- for (std::unique_ptr<InputElement> &elt : _inputArgs) {
- if (elt->getReplacements(vec))
- continue;
- vec.push_back(std::move(elt));
- }
- _inputArgs = std::move(vec);
-}
-
// If we are at the end of a group, return its size (which indicates
// how many files we need to go back in the command line).
// Returns 0 if we are not at the end of a group.
@@ -78,14 +68,6 @@ void InputGraph::skipGroup() {
_nextElementIndex++;
}
-bool FileNode::getReplacements(InputGraph::InputElementVectorT &result) {
- if (_files.size() < 2)
- return false;
- for (std::unique_ptr<File> &file : _files)
- result.push_back(llvm::make_unique<SimpleFileNode>(_path, std::move(file)));
- return true;
-}
-
std::error_code FileNode::parse(const LinkingContext &, raw_ostream &) {
for (std::unique_ptr<File> &file : _files)
if (std::error_code ec = file->parse())
Modified: lld/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=225769&r1=225768&r2=225769&view=diff
==============================================================================
--- lld/trunk/lib/Driver/Driver.cpp (original)
+++ lld/trunk/lib/Driver/Driver.cpp Mon Jan 12 23:59:17 2015
@@ -77,7 +77,6 @@ bool Driver::link(LinkingContext &contex
InputGraph &inputGraph = context.getInputGraph();
if (!inputGraph.size())
return false;
- inputGraph.normalize();
bool fail = false;
Modified: lld/trunk/unittests/DriverTests/InputGraphTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/InputGraphTest.cpp?rev=225769&r1=225768&r2=225769&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/InputGraphTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/InputGraphTest.cpp Mon Jan 12 23:59:17 2015
@@ -31,13 +31,6 @@ class TestExpandFileNode : public Simple
public:
TestExpandFileNode(StringRef path) : SimpleFileNode(path) {}
- /// Returns the elements replacing this node
- bool getReplacements(InputGraph::InputElementVectorT &result) override {
- for (std::unique_ptr<InputElement> &elt : _expandElements)
- result.push_back(std::move(elt));
- return true;
- }
-
void addElement(std::unique_ptr<InputElement> element) {
_expandElements.push_back(std::move(element));
}
@@ -88,20 +81,3 @@ TEST_F(InputGraphTest, File) {
EXPECT_EQ("file1", getNext());
expectEnd();
}
-
-// Node expansion tests
-TEST_F(InputGraphTest, Normalize) {
- _graph->addInputElement(createFile("file1"));
-
- std::unique_ptr<TestExpandFileNode> expandFile(
- new TestExpandFileNode("node"));
- expandFile->addElement(createFile("file2"));
- expandFile->addElement(createFile("file3"));
- _graph->addInputElement(std::move(expandFile));
- _graph->normalize();
-
- EXPECT_EQ("file1", getNext());
- EXPECT_EQ("file2", getNext());
- EXPECT_EQ("file3", getNext());
- expectEnd();
-}
More information about the llvm-commits
mailing list