Lines Matching refs:Magic
30 static bool startswith(StringRef Magic, const char (&S)[N]) { in startswith() argument
31 return Magic.startswith(StringRef(S, N - 1)); in startswith()
35 file_magic llvm::identify_magic(StringRef Magic) { in identify_magic() argument
36 if (Magic.size() < 4) in identify_magic()
38 switch ((unsigned char)Magic[0]) { in identify_magic()
41 if (startswith(Magic, "\0\0\xFF\xFF")) { in identify_magic()
44 if (Magic.size() < MinSize) in identify_magic()
47 const char *Start = Magic.data() + offsetof(COFF::BigObjHeader, UUID); in identify_magic()
55 if (Magic.size() >= sizeof(COFF::WinResMagic) && in identify_magic()
56 memcmp(Magic.data(), COFF::WinResMagic, sizeof(COFF::WinResMagic)) == 0) in identify_magic()
59 if (Magic[1] == 0) in identify_magic()
61 if (startswith(Magic, "\0asm")) in identify_magic()
68 if (startswith(Magic, "\x01\xDF")) in identify_magic()
70 if (startswith(Magic, "\x01\xF7")) in identify_magic()
75 if (startswith(Magic, "\xDE\xC0\x17\x0B")) in identify_magic()
79 if (startswith(Magic, "BC\xC0\xDE")) in identify_magic()
83 if (startswith(Magic, "!<arch>\n") || startswith(Magic, "!<thin>\n")) in identify_magic()
88 if (startswith(Magic, "\177ELF") && Magic.size() >= 18) { in identify_magic()
89 bool Data2MSB = Magic[5] == 2; in identify_magic()
92 if (Magic[high] == 0) { in identify_magic()
93 switch (Magic[low]) { in identify_magic()
112 if (startswith(Magic, "\xCA\xFE\xBA\xBE") || in identify_magic()
113 startswith(Magic, "\xCA\xFE\xBA\xBF")) { in identify_magic()
116 if (Magic.size() >= 8 && Magic[7] < 43) in identify_magic()
128 if (startswith(Magic, "\xFE\xED\xFA\xCE") || in identify_magic()
129 startswith(Magic, "\xFE\xED\xFA\xCF")) { in identify_magic()
132 if (Magic[3] == char(0xCE)) in identify_magic()
136 if (Magic.size() >= MinSize) in identify_magic()
137 type = Magic[12] << 24 | Magic[13] << 12 | Magic[14] << 8 | Magic[15]; in identify_magic()
138 } else if (startswith(Magic, "\xCE\xFA\xED\xFE") || in identify_magic()
139 startswith(Magic, "\xCF\xFA\xED\xFE")) { in identify_magic()
142 if (Magic[0] == char(0xCE)) in identify_magic()
146 if (Magic.size() >= MinSize) in identify_magic()
147 type = Magic[15] << 24 | Magic[14] << 12 | Magic[13] << 8 | Magic[12]; in identify_magic()
184 if (Magic[1] == 0x01) in identify_magic()
190 if (Magic[1] == 0x02) in identify_magic()
196 if (startswith(Magic, "MZ") && Magic.size() >= 0x3c + 4) { in identify_magic()
197 uint32_t off = read32le(Magic.data() + 0x3c); in identify_magic()
199 if (Magic.substr(off).startswith( in identify_magic()
203 if (Magic.startswith("Microsoft C/C++ MSF 7.00\r\n")) in identify_magic()
205 if (startswith(Magic, "MDMP")) in identify_magic()
210 if (Magic[1] == char(0x86) || Magic[1] == char(0xaa)) in identify_magic()
215 if (startswith(Magic, "--- !tapi") || startswith(Magic, "---\narchs:")) in identify_magic()