(filename)
| 137 | |
| 138 | |
| 139 | def is_bitcode(filename): |
| 140 | try: |
| 141 | # look for magic signature |
| 142 | b = open(filename, 'rb').read(4) |
| 143 | if b[:2] == b'BC': |
| 144 | return True |
| 145 | # on macOS, there is a 20-byte prefix which starts with little endian |
| 146 | # encoding of 0x0B17C0DE |
| 147 | elif b == b'\xDE\xC0\x17\x0B': |
| 148 | b = bytearray(open(filename, 'rb').read(22)) |
| 149 | return b[20:] == b'BC' |
| 150 | except IndexError: |
| 151 | # not enough characters in the input |
| 152 | # note that logging will be done on the caller function |
| 153 | pass |
| 154 | return False |
| 155 | |
| 156 | |
| 157 | def uses_canonical_tmp(func): |
no test coverage detected