3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-28 02:09:22 +00:00

Merge pull request #1466 from waywardmonkeys/reduce-copying

Use const refs to reduce copying.
This commit is contained in:
Nikolaj Bjorner 2018-02-05 16:37:44 -08:00 committed by GitHub
commit 2853558bc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 62 additions and 62 deletions

View file

@ -400,7 +400,7 @@ namespace datalog {
}
uint64 res;
if (!try_get_sort_constant_count(srt, res)) {
sort_size sz = srt->get_num_elements();
const sort_size & sz = srt->get_num_elements();
if (sz.is_finite()) {
res = sz.size();
}
@ -411,7 +411,7 @@ namespace datalog {
return res;
}
void context::set_argument_names(const func_decl * pred, svector<symbol> var_names)
void context::set_argument_names(const func_decl * pred, const svector<symbol> & var_names)
{
SASSERT(!m_argument_var_names.contains(pred));
m_argument_var_names.insert(pred, var_names);

View file

@ -368,7 +368,7 @@ namespace datalog {
These names are used when printing out the relations to make the output conform
to the one of bddbddb.
*/
void set_argument_names(const func_decl * pred, svector<symbol> var_names);
void set_argument_names(const func_decl * pred, const svector<symbol> & var_names);
symbol get_argument_name(const func_decl * pred, unsigned arg_index);
void set_predicate_representation(func_decl * pred, unsigned relation_name_cnt,

View file

@ -547,7 +547,7 @@ namespace datalog {
//
// -----------------------------------
void get_file_names(std::string directory, std::string extension, bool traverse_subdirs,
void get_file_names(std::string directory, const std::string & extension, bool traverse_subdirs,
string_vector & res) {
if(directory[directory.size()-1]!='\\' && directory[directory.size()-1]!='/') {
@ -595,7 +595,7 @@ namespace datalog {
#endif
}
bool file_exists(std::string name) {
bool file_exists(const std::string & name) {
struct stat st;
if(stat(name.c_str(),&st) == 0) {
return true;
@ -603,7 +603,7 @@ namespace datalog {
return false;
}
bool is_directory(std::string name) {
bool is_directory(const std::string & name) {
if(!file_exists(name)) {
return false;
}
@ -612,7 +612,7 @@ namespace datalog {
return (status.st_mode&S_IFDIR)!=0;
}
std::string get_file_name_without_extension(std::string name) {
std::string get_file_name_without_extension(const std::string & name) {
size_t slash_index = name.find_last_of("\\/");
size_t dot_index = name.rfind('.');
size_t ofs = (slash_index==std::string::npos) ? 0 : slash_index+1;

View file

@ -290,7 +290,7 @@ namespace datalog {
}
template<class T>
void project_out_vector_columns(T & container, const unsigned_vector removed_cols) {
void project_out_vector_columns(T & container, const unsigned_vector & removed_cols) {
project_out_vector_columns(container, removed_cols.size(), removed_cols.c_ptr());
}
@ -342,7 +342,7 @@ namespace datalog {
}
template<class T>
void permutate_by_cycle(T & container, const unsigned_vector permutation_cycle) {
void permutate_by_cycle(T & container, const unsigned_vector & permutation_cycle) {
permutate_by_cycle(container, permutation_cycle.size(), permutation_cycle.c_ptr());
}
@ -578,13 +578,13 @@ namespace datalog {
//
// -----------------------------------
void get_file_names(std::string directory, std::string extension, bool traverse_subdirs,
void get_file_names(std::string directory, const std::string & extension, bool traverse_subdirs,
string_vector & res);
bool file_exists(std::string name);
bool is_directory(std::string name);
bool file_exists(const std::string & name);
bool is_directory(const std::string & name);
std::string get_file_name_without_extension(std::string name);
std::string get_file_name_without_extension(const std::string & name);
// -----------------------------------
//