summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/include/lld/Core/InputGraph.h13
-rw-r--r--lld/include/lld/Driver/WrapperInputGraph.h2
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp2
-rw-r--r--lld/unittests/DriverTests/DriverTest.h4
4 files changed, 6 insertions, 15 deletions
diff --git a/lld/include/lld/Core/InputGraph.h b/lld/include/lld/Core/InputGraph.h
index b9b322dc4f5..07d61aced48 100644
--- a/lld/include/lld/Core/InputGraph.h
+++ b/lld/include/lld/Core/InputGraph.h
@@ -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
diff --git a/lld/include/lld/Driver/WrapperInputGraph.h b/lld/include/lld/Driver/WrapperInputGraph.h
index 031982d53cb..8003d34454e 100644
--- a/lld/include/lld/Driver/WrapperInputGraph.h
+++ b/lld/include/lld/Driver/WrapperInputGraph.h
@@ -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)) {}
};
}
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index cc2722d83eb..5723ea7dc66 100644
--- a/lld/lib/Driver/WinLinkDriver.cpp
+++ b/lld/lib/Driver/WinLinkDriver.cpp
@@ -804,7 +804,7 @@ static bool hasLibrary(const PECOFFLinkingContext &ctx, File *file) {
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;
}
diff --git a/lld/unittests/DriverTests/DriverTest.h b/lld/unittests/DriverTests/DriverTest.h
index 83e25c8d4d0..41c5bc525ee 100644
--- a/lld/unittests/DriverTests/DriverTest.h
+++ b/lld/unittests/DriverTests/DriverTest.h
@@ -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");
}
OpenPOWER on IntegriCloud