[llvm] r183745 - Convert a use of sys::identifyFileType to sys::fs::identify_magic.
Rafael Espindola
rafael.espindola at gmail.com
Tue Jun 11 07:39:59 PDT 2013
Author: rafael
Date: Tue Jun 11 09:39:59 2013
New Revision: 183745
URL: http://llvm.org/viewvc/llvm-project?rev=183745&view=rev
Log:
Convert a use of sys::identifyFileType to sys::fs::identify_magic.
No functionality change.
Modified:
llvm/trunk/lib/Object/Binary.cpp
Modified: llvm/trunk/lib/Object/Binary.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Binary.cpp?rev=183745&r1=183744&r2=183745&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Binary.cpp (original)
+++ llvm/trunk/lib/Object/Binary.cpp Tue Jun 11 09:39:59 2013
@@ -14,6 +14,7 @@
#include "llvm/Object/Binary.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
// Include headers for createBinary.
@@ -45,19 +46,19 @@ error_code object::createBinary(MemoryBu
OwningPtr<MemoryBuffer> scopedSource(Source);
if (!Source)
return make_error_code(errc::invalid_argument);
- sys::LLVMFileType type = sys::identifyFileType(Source->getBuffer());
+ sys::fs::file_magic type = sys::fs::identify_magic(Source->getBuffer());
error_code ec;
switch (type) {
- case sys::Archive_FileType: {
+ case sys::fs::file_magic::archive: {
OwningPtr<Binary> ret(new Archive(scopedSource.take(), ec));
if (ec) return ec;
Result.swap(ret);
return object_error::success;
}
- case sys::ELF_Relocatable_FileType:
- case sys::ELF_Executable_FileType:
- case sys::ELF_SharedObject_FileType:
- case sys::ELF_Core_FileType: {
+ case sys::fs::file_magic::elf_relocatable:
+ case sys::fs::file_magic::elf_executable:
+ case sys::fs::file_magic::elf_shared_object:
+ case sys::fs::file_magic::elf_core: {
OwningPtr<Binary> ret(
ObjectFile::createELFObjectFile(scopedSource.take()));
if (!ret)
@@ -65,15 +66,15 @@ error_code object::createBinary(MemoryBu
Result.swap(ret);
return object_error::success;
}
- case sys::Mach_O_Object_FileType:
- case sys::Mach_O_Executable_FileType:
- case sys::Mach_O_FixedVirtualMemorySharedLib_FileType:
- case sys::Mach_O_Core_FileType:
- case sys::Mach_O_PreloadExecutable_FileType:
- case sys::Mach_O_DynamicallyLinkedSharedLib_FileType:
- case sys::Mach_O_DynamicLinker_FileType:
- case sys::Mach_O_Bundle_FileType:
- case sys::Mach_O_DynamicallyLinkedSharedLibStub_FileType: {
+ case sys::fs::file_magic::macho_object:
+ case sys::fs::file_magic::macho_executable:
+ case sys::fs::file_magic::macho_fixed_virtual_memory_shared_lib:
+ case sys::fs::file_magic::macho_core:
+ case sys::fs::file_magic::macho_preload_executable:
+ case sys::fs::file_magic::macho_dynamically_linked_shared_lib:
+ case sys::fs::file_magic::macho_dynamic_linker:
+ case sys::fs::file_magic::macho_bundle:
+ case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub: {
OwningPtr<Binary> ret(
ObjectFile::createMachOObjectFile(scopedSource.take()));
if (!ret)
@@ -81,7 +82,8 @@ error_code object::createBinary(MemoryBu
Result.swap(ret);
return object_error::success;
}
- case sys::COFF_FileType: {
+ case sys::fs::file_magic::coff_object:
+ case sys::fs::file_magic::pecoff_executable: {
OwningPtr<Binary> ret(new COFFObjectFile(scopedSource.take(), ec));
if (ec) return ec;
Result.swap(ret);
More information about the llvm-commits
mailing list