Apply changes applied from clang-modernize

Needed 1-2 cleanups by hand. 99% was automatic.

* The version that ships with ubuntu 14.04 seems to not work.
  I had to build from scratch

* Use cmake to generate the build commands that clang-modernize wants

```sh
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:bool=true ../ChaiScript/
```

* Use the clang-modernize tool. Note that you have to be pretty explicit
  about the include paths if you want it to also update your include
  files

```sh
../llvm-build/bin/clang-modernize ../ChaiScript/src/*.cpp -for-compilers=gcc-4.8 -include /home/jason/ChaiScript/include,/hjason/ChaiScript/include/chaiscript,/home/jason/ChaiScript/include/chaiscript/dispatchkit,/home/jason/ChaiScript/include/chaiscript/language -p compile_commands.json
```

* In my case, it left some unused `typedef`s behind, which I cleaned up.
This commit is contained in:
Jason Turner
2014-05-10 08:25:38 -06:00
parent 5f2796868b
commit 6eab8ddfe1
19 changed files with 207 additions and 217 deletions

View File

@@ -253,11 +253,9 @@ namespace chaiscript
} else {
ss << " " << t_functions.size() << " overloads available:" << std::endl;
for (std::vector<chaiscript::Const_Proxy_Function>::const_iterator itr = t_functions.begin();
itr != t_functions.end();
++itr)
for (const auto & t_function : t_functions)
{
ss << " " << format_types((*itr), t_dot_notation, t_ss) << std::endl;
ss << " " << format_types((t_function), t_dot_notation, t_ss) << std::endl;
}
}
@@ -277,7 +275,7 @@ namespace chaiscript
{
std::string paramstr;
for (std::vector<Boxed_Value>::const_iterator itr = t_parameters.begin();
for (auto itr = t_parameters.begin();
itr != t_parameters.end();
++itr)
{
@@ -404,8 +402,8 @@ namespace chaiscript
oss << text;
for (unsigned int j = 0; j < this->children.size(); ++j) {
oss << this->children[j]->pretty_print();
for (auto & elem : this->children) {
oss << elem->pretty_print();
}
return oss.str();
@@ -419,8 +417,8 @@ namespace chaiscript
oss << t_prepend << "(" << ast_node_type_to_string(this->identifier) << ") "
<< this->text << " : " << this->start.line << ", " << this->start.column << std::endl;
for (unsigned int j = 0; j < this->children.size(); ++j) {
oss << this->children[j]->to_string(t_prepend + " ");
for (auto & elem : this->children) {
oss << elem->to_string(t_prepend + " ");
}
return oss.str();
}
@@ -446,15 +444,15 @@ namespace chaiscript
}
protected:
AST_Node(const std::string &t_ast_node_text, int t_id, const std::shared_ptr<std::string> &t_fname,
AST_Node(std::string t_ast_node_text, int t_id, const std::shared_ptr<std::string> &t_fname,
int t_start_line, int t_start_col, int t_end_line, int t_end_col) :
text(t_ast_node_text), identifier(t_id), filename(t_fname),
text(std::move(t_ast_node_text)), identifier(t_id), filename(t_fname),
start(t_start_line, t_start_col), end(t_end_line, t_end_col)
{
}
AST_Node(const std::string &t_ast_node_text, int t_id, const std::shared_ptr<std::string> &t_fname) :
text(t_ast_node_text), identifier(t_id), filename(t_fname) {}
AST_Node(std::string t_ast_node_text, int t_id, const std::shared_ptr<std::string> &t_fname) :
text(std::move(t_ast_node_text)), identifier(t_id), filename(t_fname) {}
virtual ~AST_Node() {}