Run clang-format on the entire repo
This patch clang-formats the entire repo. Third-party code is
excluded.
I needed to fix up the .clang-format file so that all the header
includes are ordered properly. I could have sworn that it used to work
without the extra modification, but I guess not.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I64bb9f2c795401393f9dfe2fefc4f04cb36b52f6
diff --git a/frc971/control_loops/polytope.h b/frc971/control_loops/polytope.h
index 1d707d4..794219b 100644
--- a/frc971/control_loops/polytope.h
+++ b/frc971/control_loops/polytope.h
@@ -4,8 +4,12 @@
#include "Eigen/Dense"
#ifdef __linux__
+// For reasons I haven't looked into, these headers fail to compile when
+// included after the glog header. Prevent clang-format from ordering them.
+// clang-format off
#include "third_party/cddlib/lib-src/setoper.h"
#include "third_party/cddlib/lib-src/cdd.h"
+// clang-format on
#include "glog/logging.h"
#endif // __linux__
@@ -64,11 +68,14 @@
class HVPolytope : public Polytope<number_of_dimensions, Scalar> {
public:
// Constructs a polytope given the H and k matrices.
- HVPolytope(Eigen::Ref<const Eigen::Matrix<Scalar, num_constraints,
- number_of_dimensions>> H,
- Eigen::Ref<const Eigen::Matrix<Scalar, num_constraints, 1>> k,
- Eigen::Ref<const Eigen::Matrix<Scalar, number_of_dimensions,
- num_vertices>> vertices)
+ HVPolytope(
+ Eigen::Ref<
+ const Eigen::Matrix<Scalar, num_constraints, number_of_dimensions>>
+ H,
+ Eigen::Ref<const Eigen::Matrix<Scalar, num_constraints, 1>> k,
+ Eigen::Ref<
+ const Eigen::Matrix<Scalar, number_of_dimensions, num_vertices>>
+ vertices)
: H_(H), k_(k), vertices_(vertices) {}
Eigen::Ref<const Eigen::Matrix<Scalar, num_constraints, number_of_dimensions>>
@@ -81,8 +88,7 @@
return H_;
}
- Eigen::Ref<const Eigen::Matrix<Scalar, num_constraints, 1>> static_k()
- const {
+ Eigen::Ref<const Eigen::Matrix<Scalar, num_constraints, 1>> static_k() const {
return k_;
}
Eigen::Ref<const Eigen::Matrix<Scalar, Eigen::Dynamic, 1>> k()
@@ -95,8 +101,8 @@
return vertices_;
}
- Eigen::Matrix<Scalar, number_of_dimensions, num_vertices>
- StaticVertices() const {
+ Eigen::Matrix<Scalar, number_of_dimensions, num_vertices> StaticVertices()
+ const {
return vertices_;
}
@@ -106,18 +112,16 @@
const Eigen::Matrix<Scalar, number_of_dimensions, num_vertices> vertices_;
};
-
-
#ifdef __linux__
template <int number_of_dimensions>
class HPolytope : public Polytope<number_of_dimensions> {
public:
// Constructs a polytope given the H and k matrices.
- HPolytope(
- Eigen::Ref<
- const Eigen::Matrix<double, Eigen::Dynamic, number_of_dimensions>> H,
- Eigen::Ref<const Eigen::Matrix<double, Eigen::Dynamic, 1>> k)
+ HPolytope(Eigen::Ref<const Eigen::Matrix<double, Eigen::Dynamic,
+ number_of_dimensions>>
+ H,
+ Eigen::Ref<const Eigen::Matrix<double, Eigen::Dynamic, 1>> k)
: H_(H), k_(k), vertices_(CalculateVertices(H, k)) {}
// This is an initialization function shared across all instantiations of this