diff --git a/llvm/ee.py b/llvm/ee.py index 15ede87..e5d6ef1 100644 --- a/llvm/ee.py +++ b/llvm/ee.py @@ -366,7 +366,9 @@ class TargetMachine(llvm.Ownable): '''get target data of this machine ''' ptr = _core.LLVMTargetMachineGetTargetData(self.ptr) - return TargetData(ptr) + td = TargetData(ptr) + td._own(self) + return td @property def target_name(self): diff --git a/llvm/passes.py b/llvm/passes.py index 2b50aca..b1f236c 100644 --- a/llvm/passes.py +++ b/llvm/passes.py @@ -160,6 +160,7 @@ class PassManager(object): pass_obj --- Either a Pass instance, a string name of a pass ''' if isinstance(pass_obj, Pass): + _util.check_is_unowned(pass_obj) _core.LLVMAddPass(self.ptr, pass_obj.ptr) pass_obj._own(self) # PassManager owns the pass elif _util.isstring(pass_obj): @@ -365,7 +366,7 @@ def build_pass_managers(tm, opt=2, loop_vectorize=False, vectorize=False, if inline_threshold: pmb.use_inliner_with_threshold(inline_threshold) if pm: - pm.add(tm.target_data) + pm.add(tm.target_data.clone()) pm.add(TargetLibraryInfo.new(tm.triple)) if llvm.version >= (3, 2): pm.add(TargetTransformInfo.new(tm))