(self, type_constraints: Set, var_to_typevar: Dict, codegen)
return codegen
Re-run type inference on an existing variable recovery result, then rerun codegen to generate new results.

        :return:
Re-run type inference on an existing variable recovery result, then rerun codegen to generate new results.
Re - run type inference on an existing variable recovery result then rerun codegen to generate new results .
def reflow_variable_types(self, type_constraints: Set, var_to_typevar: Dict, codegen):
        """
        Re-run type inference on an existing variable recovery result, then rerun codegen to generate new results.

        :return:
        """

        var_kb = self._variable_kb if self._variable_kb is not None else KnowledgeBase(self.project)

        if self.func.addr not in var_kb.variables:
            # for some reason variables for the current function don't really exist...
            groundtruth = {}
        else:
            var_manager = var_kb.variables[self.func.addr]
            # ground-truth types
            groundtruth = {}
            for variable in var_manager.variables_with_manual_types:
                vartype = var_manager.types.get(variable, None)
                if vartype is not None:
                    groundtruth[var_to_typevar[variable]] = vartype

        # variables that must be interpreted as structs
        if self._vars_must_struct:
            must_struct = set()
            for var, typevar in var_to_typevar.items():
                if var.ident in self._vars_must_struct:
                    must_struct.add(typevar)
        else:
            must_struct = None

        # type inference
        try:
            tp = self.project.analyses.Typehoon(type_constraints, kb=var_kb, var_mapping=var_to_typevar,
                                                must_struct=must_struct, ground_truth=groundtruth)
            tp.update_variable_types(self.func.addr, var_to_typevar)
        except Exception:  # pylint:disable=broad-except
            l.warning("Typehoon analysis failed. Variables will not have types. Please report to GitHub.",
                      exc_info=True)

        return codegen
def reflow_variable_types ( self , type_constraints : Set , var_to_typevar : Dict , codegen ) : var_kb = self . _variable_kb if self . _variable_kb is not None else KnowledgeBase ( self . project ) if self . func . addr not in var_kb . variables : # for some reason variables for the current function don't really exist... groundtruth = { } else : var_manager = var_kb . variables [ self . func . addr ] # ground-truth types groundtruth = { } for variable in var_manager . variables_with_manual_types : vartype = var_manager . types . get ( variable , None ) if vartype is not None : groundtruth [ var_to_typevar [ variable ] ] = vartype # variables that must be interpreted as structs if self . _vars_must_struct : must_struct = set ( ) for var , typevar in var_to_typevar . items ( ) : if var . ident in self . _vars_must_struct : must_struct . add ( typevar ) else : must_struct = None # type inference try : tp = self . project . analyses . Typehoon ( type_constraints , kb = var_kb , var_mapping = var_to_typevar , must_struct = must_struct , ground_truth = groundtruth ) tp . update_variable_types ( self . func . addr , var_to_typevar ) except Exception : # pylint:disable=broad-except l . warning ( "Typehoon analysis failed. Variables will not have types. Please report to GitHub." , exc_info = True ) return codegen