mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-04-01 07:11:45 +00:00
Fix isBytecodeFile to correctly recognized compressed bytecode too.
llvm-svn: 17655
This commit is contained in:
parent
28ceb24005
commit
d17e35893c
@ -242,10 +242,13 @@ bool Path::hasMagicNumber(const std::string &Magic) const {
|
||||
|
||||
bool
|
||||
Path::isBytecodeFile() const {
|
||||
if (readable()) {
|
||||
return hasMagicNumber("llvm");
|
||||
}
|
||||
return false;
|
||||
char buffer[ 4];
|
||||
buffer[0] = 0;
|
||||
std::ifstream f(path.c_str());
|
||||
f.read(buffer, 4);
|
||||
if (f.bad())
|
||||
ThrowErrno("can't read file signature");
|
||||
return 0 == memcmp(buffer,"llvc",4) || 0 == memcmp(buffer,"llvm",4);
|
||||
}
|
||||
|
||||
bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user