From c3907f387f0b2ec20913c6f869131c5ffd9f08df Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 12 Jun 2013 15:13:57 +0000 Subject: [PATCH] Inline Path::isBitcodeFile into only use and remove it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183840 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/PathV1.h | 7 ------- lib/Support/Path.cpp | 8 -------- tools/lto/LTOModule.cpp | 6 ++++-- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/include/llvm/Support/PathV1.h b/include/llvm/Support/PathV1.h index 916edaadf75..eaf25508696 100644 --- a/include/llvm/Support/PathV1.h +++ b/include/llvm/Support/PathV1.h @@ -226,13 +226,6 @@ namespace sys { /// @brief Determine if the path references an archive file. bool isArchive() const; - /// This function determines if the path name in the object references an - /// LLVM Bitcode file by looking at its magic number. - /// @returns true if the file starts with the magic number for LLVM - /// bitcode files. - /// @brief Determine if the path references a bitcode file. - bool isBitcodeFile() const; - /// This function determines if the path name in the object references a /// native Dynamic Library (shared library, shared object) by looking at /// the file's magic number. The Path object must reference a file, not a diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp index d47d23f57b0..7ddaf1e89ed 100644 --- a/lib/Support/Path.cpp +++ b/lib/Support/Path.cpp @@ -77,14 +77,6 @@ Path::appendSuffix(StringRef suffix) { } } -bool -Path::isBitcodeFile() const { - fs::file_magic type; - if (fs::identify_magic(str(), type)) - return false; - return type == fs::file_magic::bitcode; -} - // Include the truly platform-specific parts of this class. #if defined(LLVM_ON_UNIX) #include "Unix/Path.inc" diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp index 807d860b79c..263e8b346e1 100644 --- a/tools/lto/LTOModule.cpp +++ b/tools/lto/LTOModule.cpp @@ -32,7 +32,6 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" -#include "llvm/Support/PathV1.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" @@ -170,7 +169,10 @@ bool LTOModule::isBitcodeFile(const void *mem, size_t length) { } bool LTOModule::isBitcodeFile(const char *path) { - return llvm::sys::Path(path).isBitcodeFile(); + sys::fs::file_magic type; + if (sys::fs::identify_magic(path, type)) + return false; + return type == sys::fs::file_magic::bitcode; } /// isBitcodeFileForTarget - Returns 'true' if the file (or memory contents) is -- 2.11.0