mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-29 10:32:47 +00:00
Fix PR134, by checking FileOpenable() on each input file before analyzing its
type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10096 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
841d8e90ac
commit
08d03c79a2
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user