Update clang-format

This commit is contained in:
Jonathan Müller 2018-09-20 19:57:03 +02:00
commit 9f18b7f4d8
89 changed files with 11377 additions and 11546 deletions

View file

@ -5,7 +5,8 @@
/// \file
/// Generate equality comparisons.
///
/// Given an input file, it will generate comparison operators for each class that has the [[generate::comparison]] attribute.
/// Given an input file, it will generate comparison operators for each class that has the
/// [[generate::comparison]] attribute.
#include <algorithm>
#include <iostream>
@ -94,8 +95,8 @@ void generate_comparison(const cppast::cpp_file& file)
{
// it is a new class
auto& class_ = static_cast<const cppast::cpp_class&>(e);
auto& attribute =
cppast::has_attribute(e, "generate::comparison").value();
auto& attribute
= cppast::has_attribute(e, "generate::comparison").value();
// generate requested operators
if (attribute.arguments())

View file

@ -5,8 +5,9 @@
/// \file
/// Generates enum category functions.
///
/// Given an input file, it will generate definitions for functions marked with [[generate::enum_category(name)]].
/// The function takes an enumerator and will return true if it is marked with the same category.
/// Given an input file, it will generate definitions for functions marked with
/// [[generate::enum_category(name)]]. The function takes an enumerator and will return true if it
/// is marked with the same category.
#include <algorithm>
#include <cassert>
@ -24,10 +25,10 @@ bool is_category(const cppast::cpp_enum_value& e, const std::string& name)
if (auto attr = cppast::has_attribute(e, "generate::enum_category"))
{
// ... by looking for the token
auto iter =
std::find_if(attr.value().arguments().value().begin(),
attr.value().arguments().value().end(),
[&](const cppast::cpp_token& tok) { return tok.spelling == name; });
auto iter
= std::find_if(attr.value().arguments().value().begin(),
attr.value().arguments().value().end(),
[&](const cppast::cpp_token& tok) { return tok.spelling == name; });
return iter != attr.value().arguments().value().end();
}
else
@ -42,8 +43,10 @@ const cppast::cpp_enum& get_enum(const cppast::cpp_entity_index& index,
// it is an enum
assert(param_type.kind() == cppast::cpp_type_kind::user_defined_t);
// lookup definition
auto& definition =
static_cast<const cppast::cpp_user_defined_type&>(param_type).entity().get(index)[0u].get();
auto& definition = static_cast<const cppast::cpp_user_defined_type&>(param_type)
.entity()
.get(index)[0u]
.get();
assert(definition.kind() == cppast::cpp_entity_kind::enum_t);
return static_cast<const cppast::cpp_enum&>(definition);

View file

@ -5,7 +5,8 @@
/// \file
/// Generates enum `to_string()` code.
///
/// Given an input file, it will generate a to_string() function for all enums marked with [[generate::to_string]].
/// Given an input file, it will generate a to_string() function for all enums marked with
/// [[generate::to_string]].
#include <iostream>
@ -43,8 +44,8 @@ void generate_to_string(const cppast::cpp_file& file)
<< ":\n";
// attribute can be used to override the string
if (auto attr =
cppast::has_attribute(enumerator, "generate::to_string"))
if (auto attr
= cppast::has_attribute(enumerator, "generate::to_string"))
std::cout << " return "
<< attr.value().arguments().value().as_string()
<< ";\n";

View file

@ -5,7 +5,8 @@
/// \file
/// Serialization code generation.
///
/// Given an input file, it will generate a serialize() function for each class marked with [[generate::serialize]].
/// Given an input file, it will generate a serialize() function for each class marked with
/// [[generate::serialize]].
#include <iostream>