def print_module_to_file(self, filename):
out = c_char_p(None)
- result = lib.LLVMPrintModuleToFile(self, filename, byref(out))
- if not result:
+ # Result is inverted so 0 means everything was ok.
+ result = lib.LLVMPrintModuleToFile(self, filename, byref(out))
+ if result:
raise RuntimeError("LLVM Error: %s" % out.value)
class Context(LLVMObject):
def test_create_module_with_name(self):
# Make sure we can not create a module without a LLVMModuleRef.
- with self.assertRaises(RuntimeError):
+ with self.assertRaises(TypeError):
m = Module()
m = Module.CreateWithName("test-module")
def test_module_getset_target(self):
m = Module.CreateWithName("test-module")
- m.target = "thumbv7-apple-ios5.0.0"
+ target = "thumbv7-apple-ios5.0.0"
+ m.target = target
self.assertEqual(m.target, target)
def test_module_print_module_to_file(self):