[llvm] r183754 - Convert another use of sys::identifyFileType.
Rafael Espindola
rafael.espindola at gmail.com
Tue Jun 11 10:28:56 PDT 2013
Author: rafael
Date: Tue Jun 11 12:28:56 2013
New Revision: 183754
URL: http://llvm.org/viewvc/llvm-project?rev=183754&view=rev
Log:
Convert another use of sys::identifyFileType.
No functionality change.
Modified:
llvm/trunk/lib/Archive/ArchiveReader.cpp
Modified: llvm/trunk/lib/Archive/ArchiveReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Archive/ArchiveReader.cpp?rev=183754&r1=183753&r2=183754&view=diff
==============================================================================
--- llvm/trunk/lib/Archive/ArchiveReader.cpp (original)
+++ llvm/trunk/lib/Archive/ArchiveReader.cpp Tue Jun 11 12:28:56 2013
@@ -17,6 +17,7 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/IR/Module.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include <cstdio>
#include <cstdlib>
@@ -205,14 +206,11 @@ Archive::parseMemberHeader(const char*&
}
// Determine if this is a bitcode file
- switch (sys::identifyFileType(StringRef(At, 4))) {
- case sys::Bitcode_FileType:
- flags |= ArchiveMember::BitcodeFlag;
- break;
- default:
- flags &= ~ArchiveMember::BitcodeFlag;
- break;
- }
+ if (sys::fs::identify_magic(StringRef(At, 4)) ==
+ sys::fs::file_magic::bitcode)
+ flags |= ArchiveMember::BitcodeFlag;
+ else
+ flags &= ~ArchiveMember::BitcodeFlag;
// Instantiate the ArchiveMember to be filled
ArchiveMember* member = new ArchiveMember(this);
More information about the llvm-commits
mailing list