summaryrefslogtreecommitdiff
path: root/lib/Support/Path.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2011-12-13 23:17:12 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2011-12-13 23:17:12 +0000
commit5b08230930ee219382f6d0abe9d16aa160907169 (patch)
tree21c429e092426045222814e85a0c4ff62ea643c0 /lib/Support/Path.cpp
parentb92cb30cf547bf9a8590a981a49040f480c8eb82 (diff)
downloadllvm-5b08230930ee219382f6d0abe9d16aa160907169.tar.gz
llvm-5b08230930ee219382f6d0abe9d16aa160907169.tar.bz2
llvm-5b08230930ee219382f6d0abe9d16aa160907169.tar.xz
Support/FileSystem: Add file_magic and move a vew clients over to it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Path.cpp')
-rw-r--r--lib/Support/Path.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp
index 9d8decc28c..dcddeda977 100644
--- a/lib/Support/Path.cpp
+++ b/lib/Support/Path.cpp
@@ -152,31 +152,31 @@ sys::IdentifyFileType(const char *magic, unsigned length) {
bool
Path::isArchive() const {
- LLVMFileType type;
+ fs::file_magic type;
if (fs::identify_magic(str(), type))
return false;
- return type == Archive_FileType;
+ return type == fs::file_magic::archive;
}
bool
Path::isDynamicLibrary() const {
- LLVMFileType type;
+ fs::file_magic type;
if (fs::identify_magic(str(), type))
return false;
switch (type) {
default: return false;
- case Mach_O_FixedVirtualMemorySharedLib_FileType:
- case Mach_O_DynamicallyLinkedSharedLib_FileType:
- case Mach_O_DynamicallyLinkedSharedLibStub_FileType:
- case ELF_SharedObject_FileType:
- case COFF_FileType: return true;
+ case fs::file_magic::macho_fixed_virtual_memory_shared_lib:
+ case fs::file_magic::macho_dynamically_linked_shared_lib:
+ case fs::file_magic::macho_dynamically_linked_shared_lib_stub:
+ case fs::file_magic::elf_shared_object:
+ case fs::file_magic::pecoff_executable: return true;
}
}
bool
Path::isObjectFile() const {
- LLVMFileType type;
- if (fs::identify_magic(str(), type) || type == Unknown_FileType)
+ fs::file_magic type;
+ if (fs::identify_magic(str(), type) || type == fs::file_magic::unknown)
return false;
return true;
}
@@ -212,10 +212,10 @@ Path::appendSuffix(StringRef suffix) {
bool
Path::isBitcodeFile() const {
- LLVMFileType type;
+ fs::file_magic type;
if (fs::identify_magic(str(), type))
return false;
- return type == Bitcode_FileType;
+ return type == fs::file_magic::bitcode;
}
bool Path::hasMagicNumber(StringRef Magic) const {