[lld] r226143 - Remove FileNode::getPath().
Rui Ueyama
ruiu at google.com
Wed Jan 14 23:38:32 PST 2015
Author: ruiu
Date: Thu Jan 15 01:38:32 2015
New Revision: 226143
URL: http://llvm.org/viewvc/llvm-project?rev=226143&view=rev
Log:
Remove FileNode::getPath().
Previously both FileNode and File keep filename. This patch removed
that redundancy.
Modified:
lld/trunk/include/lld/Core/InputGraph.h
lld/trunk/include/lld/Driver/WrapperInputGraph.h
lld/trunk/lib/Driver/WinLinkDriver.cpp
lld/trunk/unittests/DriverTests/DriverTest.h
Modified: lld/trunk/include/lld/Core/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputGraph.h?rev=226143&r1=226142&r2=226143&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputGraph.h (original)
+++ lld/trunk/include/lld/Core/InputGraph.h Thu Jan 15 01:38:32 2015
@@ -121,18 +121,10 @@ private:
/// directly.
class FileNode : public InputElement {
public:
- FileNode(StringRef path)
- : InputElement(InputElement::Kind::File), _path(path), _done(false) {
- }
-
- FileNode(StringRef path, std::unique_ptr<File> f)
- : InputElement(InputElement::Kind::File), _path(path), _file(std::move(f)),
+ explicit FileNode(std::unique_ptr<File> f)
+ : InputElement(InputElement::Kind::File), _file(std::move(f)),
_done(false) {}
- virtual ErrorOr<StringRef> getPath(const LinkingContext &) const {
- return _path;
- }
-
virtual ~FileNode() {}
/// \brief Casting support
@@ -153,7 +145,6 @@ public:
std::error_code parse(const LinkingContext &, raw_ostream &) override;
protected:
- StringRef _path; // The path of the Input file
std::unique_ptr<File> _file; // An lld File object
// The next file that would be processed by the resolver
Modified: lld/trunk/include/lld/Driver/WrapperInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/WrapperInputGraph.h?rev=226143&r1=226142&r2=226143&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/WrapperInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/WrapperInputGraph.h Thu Jan 15 01:38:32 2015
@@ -21,7 +21,7 @@ namespace lld {
class WrapperNode : public FileNode {
public:
- WrapperNode(std::unique_ptr<File> f) : FileNode(f->path(), std::move(f)) {}
+ WrapperNode(std::unique_ptr<File> f) : FileNode(std::move(f)) {}
};
}
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=226143&r1=226142&r2=226143&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Thu Jan 15 01:38:32 2015
@@ -804,7 +804,7 @@ static bool hasLibrary(const PECOFFLinki
StringRef path = file->path();
for (std::unique_ptr<InputElement> &p : ctx.getInputGraph().members())
if (auto *f = dyn_cast<FileNode>(p.get()))
- if (*f->getPath(ctx) == path)
+ if (f->getFile()->path() == path)
return true;
return false;
}
Modified: lld/trunk/unittests/DriverTests/DriverTest.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/DriverTest.h?rev=226143&r1=226142&r2=226143&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/DriverTest.h (original)
+++ lld/trunk/unittests/DriverTests/DriverTest.h Thu Jan 15 01:38:32 2015
@@ -32,10 +32,10 @@ protected:
// Convenience method for getting i'th input files name.
std::string inputFile(int index) {
- const InputElement &inputElement =
+ InputElement &inputElement =
*linkingContext()->getInputGraph().members()[index];
if (inputElement.kind() == InputElement::Kind::File)
- return *cast<FileNode>(&inputElement)->getPath(*linkingContext());
+ return cast<FileNode>(&inputElement)->getFile()->path();
llvm_unreachable("not handling other types of input files");
}
More information about the llvm-commits
mailing list