s/My/Test/ as these classes are for tests.

llvm-svn: 208119
This commit is contained in:
Rui Ueyama 2014-05-06 19:01:56 +00:00
parent fd5c70d0ec
commit b12dcb6095
1 changed files with 13 additions and 11 deletions

View File

@ -22,21 +22,21 @@ using namespace lld;
namespace { namespace {
class MyLinkingContext : public LinkingContext { class TestLinkingContext : public LinkingContext {
public: public:
Writer &writer() const override { llvm_unreachable("no writer!"); } Writer &writer() const override { llvm_unreachable("no writer!"); }
bool validateImpl(raw_ostream &) override { return true; } bool validateImpl(raw_ostream &) override { return true; }
}; };
class MyFileNode : public SimpleFileNode { class TestFileNode : public SimpleFileNode {
public: public:
MyFileNode(StringRef path) : SimpleFileNode(path) {} TestFileNode(StringRef path) : SimpleFileNode(path) {}
void resetNextIndex() override { FileNode::resetNextIndex(); } void resetNextIndex() override { FileNode::resetNextIndex(); }
}; };
class MyExpandFileNode : public SimpleFileNode { class TestExpandFileNode : public SimpleFileNode {
public: public:
MyExpandFileNode(StringRef path) : SimpleFileNode(path) {} TestExpandFileNode(StringRef path) : SimpleFileNode(path) {}
/// Returns true as we want to expand this file /// Returns true as we want to expand this file
bool shouldExpand() const override { return true; } bool shouldExpand() const override { return true; }
@ -73,25 +73,26 @@ public:
} }
protected: protected:
MyLinkingContext _ctx; TestLinkingContext _ctx;
InputGraph *_graph; InputGraph *_graph;
}; };
} // end anonymous namespace } // end anonymous namespace
static std::unique_ptr<MyFileNode> createFile1(StringRef name) { static std::unique_ptr<TestFileNode> createFile1(StringRef name) {
std::vector<std::unique_ptr<File>> files; std::vector<std::unique_ptr<File>> files;
files.push_back(std::unique_ptr<SimpleFile>(new SimpleFile(name))); files.push_back(std::unique_ptr<SimpleFile>(new SimpleFile(name)));
std::unique_ptr<MyFileNode> file(new MyFileNode("filenode")); std::unique_ptr<TestFileNode> file(new TestFileNode("filenode"));
file->addFiles(std::move(files)); file->addFiles(std::move(files));
return file; return file;
} }
static std::unique_ptr<MyFileNode> createFile2(StringRef name1, StringRef name2) { static std::unique_ptr<TestFileNode> createFile2(StringRef name1,
StringRef name2) {
std::vector<std::unique_ptr<File>> files; std::vector<std::unique_ptr<File>> files;
files.push_back(std::unique_ptr<SimpleFile>(new SimpleFile(name1))); files.push_back(std::unique_ptr<SimpleFile>(new SimpleFile(name1)));
files.push_back(std::unique_ptr<SimpleFile>(new SimpleFile(name2))); files.push_back(std::unique_ptr<SimpleFile>(new SimpleFile(name2)));
std::unique_ptr<MyFileNode> file(new MyFileNode("filenode")); std::unique_ptr<TestFileNode> file(new TestFileNode("filenode"));
file->addFiles(std::move(files)); file->addFiles(std::move(files));
return file; return file;
} }
@ -160,7 +161,8 @@ TEST_F(InputGraphTest, Normalize) {
std::vector<std::unique_ptr<File>> objfiles; std::vector<std::unique_ptr<File>> objfiles;
_graph->addInputElement(createFile2("file1", "file2")); _graph->addInputElement(createFile2("file1", "file2"));
std::unique_ptr<MyExpandFileNode> expandFile(new MyExpandFileNode("node")); std::unique_ptr<TestExpandFileNode> expandFile(
new TestExpandFileNode("node"));
expandFile->addElement(createFile1("file3")); expandFile->addElement(createFile1("file3"));
expandFile->addElement(createFile1("file4")); expandFile->addElement(createFile1("file4"));
_graph->addInputElement(std::move(expandFile)); _graph->addInputElement(std::move(expandFile));