aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-nm/llvm-nm.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp
index ec024f9..49148a9 100644
--- a/tools/llvm-nm/llvm-nm.cpp
+++ b/tools/llvm-nm/llvm-nm.cpp
@@ -21,6 +21,7 @@
#include "Support/CommandLine.h"
#include "Support/FileUtilities.h"
#include <cctype>
+#include <cstring>
using namespace llvm;
@@ -113,18 +114,26 @@ void DumpSymbolNamesFromModule (Module *M) {
void DumpSymbolNamesFromFile (std::string &Filename) {
std::string ErrorMessage;
+ if (!FileOpenable (Filename)) {
+ std::cerr << ToolName << ": " << Filename << ": " << strerror (errno)
+ << "\n";
+ return;
+ }
if (IsBytecode (Filename)) {
Module *Result = ParseBytecodeFile(Filename, &ErrorMessage);
if (Result) {
DumpSymbolNamesFromModule (Result);
} else {
std::cerr << ToolName << ": " << Filename << ": " << ErrorMessage << "\n";
+ return;
}
} else if (IsArchive (Filename)) {
std::vector<Module *> Modules;
- if (ReadArchiveFile (Filename, Modules, &ErrorMessage))
+ if (ReadArchiveFile (Filename, Modules, &ErrorMessage)) {
std::cerr << ToolName << ": " << Filename << ": "
<< ErrorMessage << "\n";
+ return;
+ }
MultipleFiles = true;
std::for_each (Modules.begin (), Modules.end (), DumpSymbolNamesFromModule);
}