[lld] r205371 - Remove duplicate code in unit tests carried in from main code.

Rui Ueyama ruiu at google.com
Tue Apr 1 16:10:14 PDT 2014


Author: ruiu
Date: Tue Apr  1 18:10:14 2014
New Revision: 205371

URL: http://llvm.org/viewvc/llvm-project?rev=205371&view=rev
Log:
Remove duplicate code in unit tests carried in from main code.

Modified:
    lld/trunk/unittests/DriverTests/InputGraphTest.cpp

Modified: lld/trunk/unittests/DriverTests/InputGraphTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/InputGraphTest.cpp?rev=205371&r1=205370&r2=205371&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/InputGraphTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/InputGraphTest.cpp Tue Apr  1 18:10:14 2014
@@ -31,19 +31,11 @@ public:
   bool validateImpl(raw_ostream &) override { return true; }
 };
 
-class MyFileNode : public FileNode {
+class MyFileNode : public SimpleFileNode {
 public:
-  MyFileNode(StringRef path, int64_t ordinal) : FileNode(path, ordinal) {}
+  MyFileNode(StringRef path, int64_t ordinal) : SimpleFileNode(path, ordinal) {}
 
-  error_code parse(const LinkingContext &, raw_ostream &) override {
-    return error_code::success();
-  }
-
-  ErrorOr<File &> getNextFile() override {
-    if (_nextFileIndex == _files.size())
-      return make_error_code(InputGraphError::no_more_files);
-    return *_files[_nextFileIndex++];
-  }
+  void resetNextIndex() override { FileNode::resetNextIndex(); }
 };
 
 class MyGroupNode : public Group {
@@ -55,20 +47,10 @@ public:
   }
 };
 
-class MyExpandFileNode : public FileNode {
+class MyExpandFileNode : public SimpleFileNode {
 public:
   MyExpandFileNode(StringRef path, int64_t ordinal)
-      : FileNode(path, ordinal) {}
-
-  error_code parse(const LinkingContext &, raw_ostream &) override {
-    return error_code::success();
-  }
-
-  ErrorOr<File &> getNextFile() override {
-    if (_nextFileIndex == _files.size())
-      return make_error_code(InputGraphError::no_more_files);
-    return *_files[_nextFileIndex++];
-  }
+      : SimpleFileNode(path, ordinal) {}
 
   /// \brief How do we want to expand the current node ?
   bool shouldExpand() const override { return true; }





More information about the llvm-commits mailing list