MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / is_bitcode

Function is_bitcode

test/test_other.py:139–154  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

137
138
139def 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
157def uses_canonical_tmp(func):

Callers 6

test_bitcode_linkingMethod · 0.85
test_emit_llvmMethod · 0.85
test_ltoMethod · 0.85
test_lto_flagsMethod · 0.85
test_is_bitcodeMethod · 0.85
test_bitcode_inputMethod · 0.85

Calls 2

openFunction · 0.50
readMethod · 0.45

Tested by

no test coverage detected