18 #if !defined(_MSC_VER) && !defined(__MINGW32__) 37 switch ((
unsigned char)Magic[0]) {
43 if (Magic.
size() < MinSize)
88 bool Data2MSB = Magic[5] == 2;
89 unsigned high = Data2MSB ? 16 : 17;
90 unsigned low = Data2MSB ? 17 : 16;
91 if (Magic[high] == 0) {
115 if (Magic.
size() >= 8 && Magic[7] < 43)
131 if (Magic[3] ==
char(0xCE))
135 if (Magic.
size() >= MinSize)
136 type = Magic[12] << 24 | Magic[13] << 12 | Magic[14] << 8 | Magic[15];
137 }
else if (
startswith(Magic,
"\xCE\xFA\xED\xFE") ||
141 if (Magic[0] ==
char(0xCE))
145 if (Magic.
size() >= MinSize)
146 type = Magic[15] << 24 | Magic[14] << 12 | Magic[13] << 8 | Magic[12];
183 if (Magic[1] == 0x01)
189 if (Magic[1] == 0x02)
202 if (Magic.
startswith(
"Microsoft C/C++ MSF 7.00\r\n"))
209 if (Magic[1] ==
char(0x86) || Magic[1] == char(0xaa))
227 return FileOrError.getError();
229 std::unique_ptr<MemoryBuffer> FileBuffer = std::move(*FileOrError);
232 return std::error_code();
This class represents lattice values for constants.
Microsoft cl.exe's intermediate code file.
ELF dynamically linked shared lib.
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Windows compiled resource file (.res)
Mach-O Preloaded Executable.
static const char BigObjMagic[]
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
The Mach-O dynamic linker.
LLVM_NODISCARD StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
ELF Relocatable object file.
static bool startswith(StringRef Magic, const char(&S)[N])
LLVM_NODISCARD size_t size() const
size - Get the string size.
static const char ClGlObjMagic[]
Mach-O dSYM companion file.
#define offsetof(TYPE, MEMBER)
static const char *const Magic
Mach-O dynlinked shared lib.
std::pair< llvm::MachO::Target, std::string > UUID
Merge contiguous icmps into a memcmp
uint32_t read32le(const void *P)
static const char PEMagic[]
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, int64_t FileSize=-1, bool RequiresNullTerminator=true, bool IsVolatile=false)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.
static const char WinResMagic[]
LLVM_NODISCARD const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
StringRef - Represent a constant reference to a string, i.e.
Windows PDB debug info file.
Text-based Dynamic Library Stub file.
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...