diff options
Diffstat (limited to 'tools/llvm-nm/llvm-nm.cpp')
-rw-r--r-- | tools/llvm-nm/llvm-nm.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index 132644d8d2f..16615964a30 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -26,6 +26,7 @@ #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Signals.h" +#include "llvm/Support/system_error.h" #include <algorithm> #include <cctype> #include <cerrno> @@ -143,8 +144,11 @@ static void DumpSymbolNamesFromFile(std::string &Filename) { sys::Path aPath(Filename); // Note: Currently we do not support reading an archive from stdin. if (Filename == "-" || aPath.isBitcodeFile()) { + error_code ec; std::auto_ptr<MemoryBuffer> Buffer( - MemoryBuffer::getFileOrSTDIN(Filename, &ErrorMessage)); + MemoryBuffer::getFileOrSTDIN(Filename, ec)); + if (Buffer.get() == 0) + ErrorMessage = ec.message(); Module *Result = 0; if (Buffer.get()) Result = ParseBitcodeFile(Buffer.get(), Context, &ErrorMessage); |