summaryrefslogtreecommitdiff
path: root/tools/llvm-mc
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2015-09-14 17:10:01 +0000
committerDavide Italiano <davide@freebsd.org>2015-09-14 17:10:01 +0000
commit97095fc404d5bc58e411c193e8e86709a8c8e646 (patch)
treeafd5dbd712711e30a3ea63ef5a56ff774dfeb79a /tools/llvm-mc
parentafca6b4138a3b9deb57fbd2e0d7a23afd8d174ce (diff)
[llvm-mc] Better error handling in ENOENT case + test.
This is a follow up to r247518. As a general note, I think we could do a much better job testing for error conditions in tools. I already anticipated in a previous mail, but while implementing this I noticed that the code coverage we have for error checking is pretty low. I can arbitrarily remove checks from several tools and the suite still passes. Differential Revision: http://reviews.llvm.org/D12846 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247582 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc')
-rw-r--r--tools/llvm-mc/llvm-mc.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 678ad360330..6e6b748c3d2 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -395,15 +395,10 @@ int main(int argc, char **argv) {
// construct the Triple object.
Triple TheTriple(TripleName);
- if (InputFilename != "-" && !sys::fs::exists(InputFilename)) {
- errs() << ProgName << ": '" << InputFilename << "': "
- << "No such file\n";
- return 1;
- }
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferPtr =
MemoryBuffer::getFileOrSTDIN(InputFilename);
if (std::error_code EC = BufferPtr.getError()) {
- errs() << ProgName << ": " << EC.message() << '\n';
+ errs() << InputFilename << ": " << EC.message() << '\n';
return 1;
}
MemoryBuffer *Buffer = BufferPtr->get();