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:
@@ -252,7 +252,7 @@ namespace chaiscript
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool operator==(const dispatch::Proxy_Function_Base &rhs) const
|
||||
virtual bool operator==(const dispatch::Proxy_Function_Base &rhs) const override
|
||||
{
|
||||
try {
|
||||
const Dispatch_Function &dispatchfun = dynamic_cast<const Dispatch_Function &>(rhs);
|
||||
@@ -264,17 +264,17 @@ namespace chaiscript
|
||||
|
||||
virtual ~Dispatch_Function() {}
|
||||
|
||||
virtual std::vector<Const_Proxy_Function> get_contained_functions() const
|
||||
virtual std::vector<Const_Proxy_Function> get_contained_functions() const override
|
||||
{
|
||||
return std::vector<Const_Proxy_Function>(m_funcs.begin(), m_funcs.end());
|
||||
}
|
||||
|
||||
|
||||
virtual int get_arity() const
|
||||
virtual int get_arity() const override
|
||||
{
|
||||
typedef std::vector<Proxy_Function> function_vec;
|
||||
|
||||
function_vec::const_iterator begin = m_funcs.begin();
|
||||
auto begin = m_funcs.begin();
|
||||
const function_vec::const_iterator end = m_funcs.end();
|
||||
|
||||
if (begin != end)
|
||||
@@ -300,12 +300,10 @@ namespace chaiscript
|
||||
return -1; // unknown arity
|
||||
}
|
||||
|
||||
virtual bool call_match(const std::vector<Boxed_Value> &vals, const Dynamic_Cast_Conversions &t_conversions) const
|
||||
virtual bool call_match(const std::vector<Boxed_Value> &vals, const Dynamic_Cast_Conversions &t_conversions) const override
|
||||
{
|
||||
typedef std::vector<Proxy_Function> function_vec;
|
||||
|
||||
function_vec::const_iterator begin = m_funcs.begin();
|
||||
function_vec::const_iterator end = m_funcs.end();
|
||||
auto begin = m_funcs.begin();
|
||||
auto end = m_funcs.end();
|
||||
|
||||
while (begin != end)
|
||||
{
|
||||
@@ -320,13 +318,13 @@ namespace chaiscript
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual std::string annotation() const
|
||||
virtual std::string annotation() const override
|
||||
{
|
||||
return "Multiple method dispatch function wrapper.";
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual Boxed_Value do_call(const std::vector<Boxed_Value> ¶ms, const Dynamic_Cast_Conversions &t_conversions) const
|
||||
virtual Boxed_Value do_call(const std::vector<Boxed_Value> ¶ms, const Dynamic_Cast_Conversions &t_conversions) const override
|
||||
{
|
||||
return dispatch::dispatch(m_funcs.begin(), m_funcs.end(), params, t_conversions);
|
||||
}
|
||||
@@ -338,7 +336,7 @@ namespace chaiscript
|
||||
{
|
||||
typedef std::vector<Proxy_Function> function_vec;
|
||||
|
||||
function_vec::const_iterator begin = t_funcs.begin();
|
||||
auto begin = t_funcs.begin();
|
||||
const function_vec::const_iterator end = t_funcs.end();
|
||||
|
||||
if (begin != end)
|
||||
@@ -477,7 +475,7 @@ namespace chaiscript
|
||||
validate_object_name(name);
|
||||
|
||||
Scope &scope = stack.back();
|
||||
Scope::iterator itr = scope.find(name);
|
||||
auto itr = scope.find(name);
|
||||
if (itr != stack.back().end())
|
||||
{
|
||||
throw chaiscript::exception::name_conflict_error(name);
|
||||
@@ -598,7 +596,7 @@ namespace chaiscript
|
||||
{
|
||||
chaiscript::detail::threading::shared_lock<chaiscript::detail::threading::shared_mutex> l(m_global_object_mutex);
|
||||
|
||||
std::map<std::string, Boxed_Value>::const_iterator itr = m_state.m_global_objects.find(name);
|
||||
auto itr = m_state.m_global_objects.find(name);
|
||||
if (itr != m_state.m_global_objects.end())
|
||||
{
|
||||
return itr->second;
|
||||
@@ -628,7 +626,7 @@ namespace chaiscript
|
||||
{
|
||||
chaiscript::detail::threading::shared_lock<chaiscript::detail::threading::shared_mutex> l(m_mutex);
|
||||
|
||||
Type_Name_Map::const_iterator itr = m_state.m_types.find(name);
|
||||
auto itr = m_state.m_types.find(name);
|
||||
|
||||
if (itr != m_state.m_types.end())
|
||||
{
|
||||
@@ -647,13 +645,11 @@ namespace chaiscript
|
||||
{
|
||||
chaiscript::detail::threading::shared_lock<chaiscript::detail::threading::shared_mutex> l(m_mutex);
|
||||
|
||||
for (Type_Name_Map::const_iterator itr = m_state.m_types.begin();
|
||||
itr != m_state.m_types.end();
|
||||
++itr)
|
||||
for (const auto & elem : m_state.m_types)
|
||||
{
|
||||
if (itr->second.bare_equal(ti))
|
||||
if (elem.second.bare_equal(ti))
|
||||
{
|
||||
return itr->first;
|
||||
return elem.first;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -680,7 +676,7 @@ namespace chaiscript
|
||||
|
||||
const std::map<std::string, std::vector<Proxy_Function> > &funs = get_functions_int();
|
||||
|
||||
std::map<std::string, std::vector<Proxy_Function> >::const_iterator itr
|
||||
auto itr
|
||||
= funs.find(t_name);
|
||||
|
||||
if (itr != funs.end())
|
||||
@@ -699,7 +695,7 @@ namespace chaiscript
|
||||
|
||||
const std::map<std::string, Proxy_Function> &funs = get_function_objects_int();
|
||||
|
||||
std::map<std::string, Proxy_Function>::const_iterator itr = funs.find(t_name);
|
||||
auto itr = funs.find(t_name);
|
||||
|
||||
if (itr != funs.end())
|
||||
{
|
||||
@@ -756,7 +752,7 @@ namespace chaiscript
|
||||
|
||||
// note: map insert doesn't overwrite existing values, which is why this works
|
||||
|
||||
for (StackData::reverse_iterator itr = stack.rbegin(); itr != stack.rend(); ++itr)
|
||||
for (auto itr = stack.rbegin(); itr != stack.rend(); ++itr)
|
||||
{
|
||||
retval.insert(itr->begin(), itr->end());
|
||||
}
|
||||
@@ -783,11 +779,9 @@ namespace chaiscript
|
||||
|
||||
std::map<std::string, Boxed_Value> objs;
|
||||
|
||||
for (std::map<std::string, Proxy_Function>::const_iterator itr = funs.begin();
|
||||
itr != funs.end();
|
||||
++itr)
|
||||
for (const auto & fun : funs)
|
||||
{
|
||||
objs.insert(std::make_pair(itr->first, const_var(itr->second)));
|
||||
objs.insert(std::make_pair(fun.first, const_var(fun.second)));
|
||||
}
|
||||
|
||||
return objs;
|
||||
@@ -805,15 +799,11 @@ namespace chaiscript
|
||||
|
||||
const std::map<std::string, std::vector<Proxy_Function> > &functions = get_functions_int();
|
||||
|
||||
for (std::map<std::string, std::vector<Proxy_Function> >::const_iterator itr = functions.begin();
|
||||
itr != functions.end();
|
||||
++itr)
|
||||
for (const auto & function : functions)
|
||||
{
|
||||
for (std::vector<Proxy_Function>::const_iterator itr2 = itr->second.begin();
|
||||
itr2 != itr->second.end();
|
||||
++itr2)
|
||||
for (const auto & internal_func : function.second)
|
||||
{
|
||||
rets.push_back(std::make_pair(itr->first, *itr2));
|
||||
rets.push_back(std::make_pair(function.first, internal_func));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1171,7 +1161,7 @@ namespace chaiscript
|
||||
|
||||
std::map<std::string, std::vector<Proxy_Function> > &funcs = get_functions_int();
|
||||
|
||||
std::map<std::string, std::vector<Proxy_Function> >::iterator itr
|
||||
auto itr
|
||||
= funcs.find(t_name);
|
||||
|
||||
std::map<std::string, Proxy_Function> &func_objs = get_function_objects_int();
|
||||
|
Reference in New Issue
Block a user