[lld] r226139 - Simplify FileNode.
Rui Ueyama
ruiu at google.com
Wed Jan 14 23:15:37 PST 2015
Author: ruiu
Date: Thu Jan 15 01:15:36 2015
New Revision: 226139
URL: http://llvm.org/viewvc/llvm-project?rev=226139&view=rev
Log:
Simplify FileNode.
The member function was defined to allow subclasses to customize
error message. But since we only have one FileNode type, there's
no actual need for that.
Modified:
lld/trunk/include/lld/Core/InputGraph.h
lld/trunk/lib/Driver/Driver.cpp
Modified: lld/trunk/include/lld/Core/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/InputGraph.h?rev=226139&r1=226138&r2=226139&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/InputGraph.h (original)
+++ lld/trunk/include/lld/Core/InputGraph.h Thu Jan 15 01:15:36 2015
@@ -149,12 +149,6 @@ public:
return a->kind() == InputElement::Kind::File;
}
- /// \brief create an error string for printing purposes
- virtual std::string errStr(std::error_code errc) {
- std::string msg = errc.message();
- return (Twine("Cannot open ") + _path + ": " + msg).str();
- }
-
/// \brief Get the list of files
File *getFile() { return _file.get(); }
Modified: lld/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/Driver.cpp?rev=226139&r1=226138&r2=226139&view=diff
==============================================================================
--- lld/trunk/lib/Driver/Driver.cpp (original)
+++ lld/trunk/lib/Driver/Driver.cpp Thu Jan 15 01:15:36 2015
@@ -94,10 +94,12 @@ bool Driver::link(LinkingContext &contex
llvm::raw_string_ostream stream(buf);
if (std::error_code ec = ie->parse(context, stream)) {
- if (FileNode *fileNode = dyn_cast<FileNode>(ie.get()))
- stream << fileNode->errStr(ec) << "\n";
- else
+ if (FileNode *fileNode = dyn_cast<FileNode>(ie.get())) {
+ stream << "Cannot open " + fileNode->getFile()->path()
+ << ": " << ec.message() << "\n";
+ } else {
llvm_unreachable("Unknown type of input element");
+ }
fail = true;
}
More information about the llvm-commits
mailing list