Update clang-format to version 11

This is taken from the Godot repository, so formatting is similar. This
updates the style rules as well.

Also fix style in files to conform with this version.
This commit is contained in:
George Marques
2021-02-28 16:52:06 -03:00
parent 77d41fa179
commit cba90d6301
26 changed files with 62 additions and 288 deletions

View File

@@ -16,12 +16,10 @@ public:
real_t get_area() const; /// get area
inline bool has_no_area() const {
return (size.x <= CMP_EPSILON || size.y <= CMP_EPSILON || size.z <= CMP_EPSILON);
}
inline bool has_no_surface() const {
return (size.x <= CMP_EPSILON && size.y <= CMP_EPSILON && size.z <= CMP_EPSILON);
}

View File

@@ -14,7 +14,6 @@ using namespace godot;
} // namespace
struct CameraMatrix {
enum Planes {
PLANE_NEAR,
PLANE_FAR,
@@ -84,7 +83,6 @@ struct CameraMatrix {
};
Vector3 CameraMatrix::xform(const Vector3 &p_vec3) const {
Vector3 ret;
ret.x = matrix[0][0] * p_vec3.x + matrix[1][0] * p_vec3.y + matrix[2][0] * p_vec3.z + matrix[3][0];
ret.y = matrix[0][1] * p_vec3.x + matrix[1][1] * p_vec3.y + matrix[2][1] * p_vec3.z + matrix[3][1];

View File

@@ -11,12 +11,10 @@
namespace godot {
struct Color {
private:
// static float _parse_col(const String& p_str, int p_ofs);
public:
union {
struct {
float r;
float g;

View File

@@ -321,7 +321,6 @@ void register_method(const char *name, M method_ptr, godot_method_rpc_mode rpc_t
template <class D, class B, class R, class... As>
void register_method_explicit(const char *name, R (B::*method_ptr)(As...),
godot_method_rpc_mode rpc_type = GODOT_METHOD_RPC_MODE_DISABLED) {
static_assert(std::is_base_of<B, D>::value, "Explicit class must derive from method class");
register_method(name, static_cast<R (D::*)(As...)>(method_ptr), rpc_type);
}
@@ -394,7 +393,6 @@ void register_property(const char *name, P(T::*var), P default_value,
godot_method_rpc_mode rpc_mode = GODOT_METHOD_RPC_MODE_DISABLED,
godot_property_usage_flags usage = GODOT_PROPERTY_USAGE_DEFAULT,
godot_property_hint hint = GODOT_PROPERTY_HINT_NONE, String hint_string = "") {
static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes");
Variant def_val = default_value;
@@ -451,7 +449,6 @@ void register_property(const char *name, void (T::*setter)(P), P (T::*getter)(),
godot_method_rpc_mode rpc_mode = GODOT_METHOD_RPC_MODE_DISABLED,
godot_property_usage_flags usage = GODOT_PROPERTY_USAGE_DEFAULT,
godot_property_hint hint = GODOT_PROPERTY_HINT_NONE, String hint_string = "") {
static_assert(T::___CLASS_IS_SCRIPT, "This function must only be used on custom classes");
Variant def_val = default_value;
@@ -495,7 +492,6 @@ void register_property(const char *name, void (T::*setter)(P), P (T::*getter)()
godot_method_rpc_mode rpc_mode = GODOT_METHOD_RPC_MODE_DISABLED,
godot_property_usage_flags usage = GODOT_PROPERTY_USAGE_DEFAULT,
godot_property_hint hint = GODOT_PROPERTY_HINT_NONE, String hint_string = "") {
register_property(name, setter, (P(T::*)())getter, default_value, rpc_mode, usage, hint, hint_string);
}

View File

@@ -23,7 +23,6 @@ extern "C" const godot_gdnative_ext_net_3_2_api_struct *net_3_2_api;
extern "C" const void *gdnlib;
class Godot {
public:
static void print(const String &message);
static void print_warning(const String &description, const String &function, const String &file, int line);

View File

@@ -232,7 +232,6 @@ inline double stepify(double p_value, double p_step) {
}
inline unsigned int next_power_of_2(unsigned int x) {
if (x == 0)
return 0;

View File

@@ -26,7 +26,6 @@ class PoolByteArray {
public:
class Read {
friend class PoolByteArray;
godot_pool_byte_array_read_access *_read_access;

View File

@@ -17,7 +17,6 @@ typedef Vector2 Point2;
struct Transform2D;
struct Rect2 {
Point2 position;
Size2 size;
@@ -48,14 +47,12 @@ struct Rect2 {
bool intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_position = nullptr, Point2 *r_normal = nullptr) const;
inline bool encloses(const Rect2 &p_rect) const {
return (p_rect.position.x >= position.x) && (p_rect.position.y >= position.y) &&
((p_rect.position.x + p_rect.size.x) < (position.x + size.x)) &&
((p_rect.position.y + p_rect.size.y) < (position.y + size.y));
}
inline bool has_no_area() const {
return (size.x <= 0 || size.y <= 0);
}
Rect2 clip(const Rect2 &p_rect) const;
@@ -82,7 +79,6 @@ struct Rect2 {
inline bool operator!=(const Rect2 &p_rect) const { return position != p_rect.position || size != p_rect.size; }
inline Rect2 grow(real_t p_by) const {
Rect2 g = *this;
g.position.x -= p_by;
g.position.y -= p_by;
@@ -92,7 +88,6 @@ struct Rect2 {
}
inline Rect2 expand(const Vector2 &p_vector) const {
Rect2 r = *this;
r.expand_to(p_vector);
return r;

View File

@@ -19,7 +19,6 @@ class Ref {
T *reference = nullptr;
void ref(const Ref &p_from) {
if (p_from.reference == reference)
return;
@@ -31,7 +30,6 @@ class Ref {
}
void ref_pointer(T *p_ref) {
ERR_FAIL_COND(p_ref == nullptr);
if (p_ref->init_ref())
@@ -40,44 +38,35 @@ class Ref {
public:
inline bool operator<(const Ref<T> &p_r) const {
return reference < p_r.reference;
}
inline bool operator==(const Ref<T> &p_r) const {
return reference == p_r.reference;
}
inline bool operator!=(const Ref<T> &p_r) const {
return reference != p_r.reference;
}
inline T *operator->() {
return reference;
}
inline T *operator*() {
return reference;
}
inline const T *operator->() const {
return reference;
}
inline const T *ptr() const {
return reference;
}
inline T *ptr() {
return reference;
}
inline const T *operator*() const {
return reference;
}
@@ -88,7 +77,6 @@ public:
}
void operator=(const Ref &p_from) {
ref(p_from);
}
@@ -118,7 +106,6 @@ public:
}
Ref(const Ref &p_from) {
reference = nullptr;
ref(p_from);
}
@@ -138,7 +125,6 @@ public:
}
Ref(T *p_reference) {
if (p_reference)
ref_pointer(p_reference);
else
@@ -146,7 +132,6 @@ public:
}
Ref(const Variant &p_variant) {
reference = nullptr;
Object *refb = T::___get_from_variant(p_variant);
if (refb == nullptr) {
@@ -168,7 +153,6 @@ public:
// mutexes will avoid more crashes?
if (reference && reference->unreference()) {
//memdelete(reference);
reference->free();
}
@@ -181,12 +165,10 @@ public:
}
Ref() {
reference = nullptr;
}
~Ref() {
unref();
}

View File

@@ -14,7 +14,6 @@ class PoolStringArray;
class String;
class CharString {
friend class String;
godot_char_string _char_string;

View File

@@ -14,7 +14,6 @@ namespace godot {
class Basis;
struct Vector3 {
enum Axis {
AXIS_X,
AXIS_Y,
@@ -305,7 +304,6 @@ inline Vector3 operator*(real_t p_scalar, const Vector3 &p_vec) {
}
inline Vector3 vec3_cross(const Vector3 &p_a, const Vector3 &p_b) {
return p_a.cross(p_b);
}