3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-28 03:15:50 +00:00

Use const refs to reduce copying.

These are things that have been found by `clang-tidy`.
This commit is contained in:
Bruce Mitchener 2018-01-30 21:43:56 +07:00
parent 5a16d3ef7f
commit 177414c0ee
28 changed files with 62 additions and 62 deletions

View file

@ -1924,7 +1924,7 @@ namespace datalog {
}
}
void finite_product_relation::extract_table_fact(const relation_fact rf, table_fact & tf) const {
void finite_product_relation::extract_table_fact(const relation_fact & rf, table_fact & tf) const {
const relation_signature & sig = get_signature();
relation_manager & rmgr = get_manager();
@ -1940,7 +1940,7 @@ namespace datalog {
tf.push_back(0);
}
void finite_product_relation::extract_other_fact(const relation_fact rf, relation_fact & of) const {
void finite_product_relation::extract_other_fact(const relation_fact & rf, relation_fact & of) const {
of.reset();
unsigned o_sz = m_other_sig.size();
for(unsigned i=0; i<o_sz; i++) {

View file

@ -281,11 +281,11 @@ namespace datalog {
\brief Extract the values of table non-functional columns from the relation fact.
The value of the functional column which determines index of the inner relation is undefined.
*/
void extract_table_fact(const relation_fact rf, table_fact & tf) const;
void extract_table_fact(const relation_fact & rf, table_fact & tf) const;
/**
\brief Extract the values of the inner relation columns from the relation fact.
*/
void extract_other_fact(const relation_fact rf, relation_fact & of) const;
void extract_other_fact(const relation_fact & rf, relation_fact & of) const;
relation_base * mk_empty_inner();
relation_base * mk_full_inner(func_decl* pred);

View file

@ -168,7 +168,7 @@ namespace datalog {
}
void instruction::display_indented(execution_context const & _ctx, std::ostream & out, std::string indentation) const {
void instruction::display_indented(execution_context const & _ctx, std::ostream & out, const std::string & indentation) const {
out << indentation;
rel_context const& ctx = _ctx.get_rel_context();
display_head_impl(_ctx, out);
@ -191,7 +191,7 @@ namespace datalog {
reg_idx m_reg;
public:
instr_io(bool store, func_decl_ref pred, reg_idx reg)
: m_store(store), m_pred(pred), m_reg(reg) {}
: m_store(store), m_pred(std::move(pred)), m_reg(reg) {}
virtual bool perform(execution_context & ctx) {
log_verbose(ctx);
if (m_store) {
@ -348,7 +348,7 @@ namespace datalog {
out << "while";
print_container(m_controls, out);
}
virtual void display_body_impl(execution_context const & ctx, std::ostream & out, std::string indentation) const {
virtual void display_body_impl(execution_context const & ctx, std::ostream & out, const std::string & indentation) const {
m_body->display_indented(ctx, out, indentation+" ");
}
};
@ -1182,7 +1182,7 @@ namespace datalog {
}
}
void instruction_block::display_indented(execution_context const& _ctx, std::ostream & out, std::string indentation) const {
void instruction_block::display_indented(execution_context const& _ctx, std::ostream & out, const std::string & indentation) const {
rel_context const& ctx = _ctx.get_rel_context();
instr_seq_type::const_iterator it = m_data.begin();
instr_seq_type::const_iterator end = m_data.end();

View file

@ -150,7 +150,7 @@ namespace datalog {
return m_reg_annotation.find(reg, res);
}
void set_register_annotation(reg_idx reg, std::string str) {
void set_register_annotation(reg_idx reg, const std::string & str) {
m_reg_annotation.insert(reg, str);
}
@ -233,7 +233,7 @@ namespace datalog {
Each line must be prepended by \c indentation and ended by a newline character.
*/
virtual void display_body_impl(execution_context const & ctx, std::ostream & out, std::string indentation) const {}
virtual void display_body_impl(execution_context const & ctx, std::ostream & out, const std::string & indentation) const {}
void log_verbose(execution_context& ctx);
public:
@ -249,7 +249,7 @@ namespace datalog {
void display(execution_context const& ctx, std::ostream & out) const {
display_indented(ctx, out, "");
}
void display_indented(execution_context const & ctx, std::ostream & out, std::string indentation) const;
void display_indented(execution_context const & ctx, std::ostream & out, const std::string & indentation) const;
static instruction * mk_load(ast_manager & m, func_decl * pred, reg_idx tgt);
/**
@ -359,7 +359,7 @@ namespace datalog {
void display(execution_context const & ctx, std::ostream & out) const {
display_indented(ctx, out, "");
}
void display_indented(execution_context const & ctx, std::ostream & out, std::string indentation) const;
void display_indented(execution_context const & ctx, std::ostream & out, const std::string & indentation) const;
unsigned num_instructions() const { return m_data.size(); }
};

View file

@ -454,7 +454,7 @@ namespace datalog {
: m_manager(ctx.get_manager()),
m_subst(ctx.get_var_subst()),
m_col_idx(col_idx),
m_new_rule(new_rule) {}
m_new_rule(std::move(new_rule)) {}
virtual void operator()(relation_base & r0) {
explanation_relation & r = static_cast<explanation_relation &>(r0);

View file

@ -488,7 +488,7 @@ namespace datalog {
ptr_vector<relation_transformer_fn> m_transforms;
public:
transform_fn(relation_signature s, unsigned num_trans, relation_transformer_fn** trans):
m_sig(s),
m_sig(std::move(s)),
m_transforms(num_trans, trans) {}
~transform_fn() { dealloc_ptr_vector_content(m_transforms); }

View file

@ -289,7 +289,7 @@ namespace datalog {
relation_transformer_fn * mk_permutation_rename_fn(const relation_base & t,
const unsigned * permutation);
relation_transformer_fn * mk_permutation_rename_fn(const relation_base & t,
const unsigned_vector permutation) {
const unsigned_vector & permutation) {
SASSERT(t.get_signature().size()==permutation.size());
return mk_permutation_rename_fn(t, permutation.c_ptr());
}
@ -343,7 +343,7 @@ namespace datalog {
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, unsigned col_cnt,
const unsigned * identical_cols);
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, const unsigned_vector identical_cols) {
relation_mutator_fn * mk_filter_identical_fn(const relation_base & t, const unsigned_vector & identical_cols) {
return mk_filter_identical_fn(t, identical_cols.size(), identical_cols.c_ptr());
}
@ -468,7 +468,7 @@ namespace datalog {
of column number.
*/
table_transformer_fn * mk_permutation_rename_fn(const table_base & t, const unsigned * permutation);
table_transformer_fn * mk_permutation_rename_fn(const table_base & t, const unsigned_vector permutation) {
table_transformer_fn * mk_permutation_rename_fn(const table_base & t, const unsigned_vector & permutation) {
SASSERT(t.get_signature().size()==permutation.size());
return mk_permutation_rename_fn(t, permutation.c_ptr());
}
@ -522,7 +522,7 @@ namespace datalog {
table_mutator_fn * mk_filter_identical_fn(const table_base & t, unsigned col_cnt,
const unsigned * identical_cols);
table_mutator_fn * mk_filter_identical_fn(const table_base & t, const unsigned_vector identical_cols) {
table_mutator_fn * mk_filter_identical_fn(const table_base & t, const unsigned_vector & identical_cols) {
return mk_filter_identical_fn(t, identical_cols.size(), identical_cols.c_ptr());
}

View file

@ -108,7 +108,7 @@ namespace datalog {
sieve_relation * mk_from_inner(const relation_signature & s, const bool * inner_columns,
relation_base * inner_rel);
sieve_relation * mk_from_inner(const relation_signature & s, const svector<bool> inner_columns,
sieve_relation * mk_from_inner(const relation_signature & s, const svector<bool> & inner_columns,
relation_base * inner_rel) {
SASSERT(inner_columns.size()==s.size());
return mk_from_inner(s, inner_columns.c_ptr(), inner_rel);

View file

@ -240,7 +240,7 @@ namespace datalog {
const table_relation & tr_src = static_cast<const table_relation &>(src);
relation_manager & rmgr = tr_src.get_manager();
relation_signature sig = tr_src.get_signature();
const relation_signature & sig = tr_src.get_signature();
SASSERT(tgt.get_signature()==sig);
SASSERT(!delta || delta->get_signature()==sig);