[Bf-blender-cvs] [8d5073345d7] master: Cleanup: Clang-Tidy, modernize-use-emplace
Sergey Sharybin
noreply at git.blender.org
Fri Nov 6 14:08:18 CET 2020
Commit: 8d5073345d7e3f66d08e2f5587c8ad8cc1d812fa
Author: Sergey Sharybin
Date: Fri Nov 6 14:06:52 2020 +0100
Branches: master
https://developer.blender.org/rB8d5073345d7e3f66d08e2f5587c8ad8cc1d812fa
Cleanup: Clang-Tidy, modernize-use-emplace
===================================================================
M .clang-tidy
M source/blender/freestyle/intern/application/Controller.cpp
M source/blender/freestyle/intern/geometry/Bezier.cpp
M source/blender/freestyle/intern/geometry/FitCurve.cpp
M source/blender/freestyle/intern/geometry/GeomCleaner.cpp
M source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
M source/blender/freestyle/intern/stroke/Stroke.cpp
M source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
M source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
M source/blender/freestyle/intern/winged_edge/WFillGrid.cpp
M source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp
M source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
M source/blender/io/alembic/exporter/abc_writer_hair.cc
M source/blender/io/alembic/exporter/abc_writer_points.cc
M source/blender/io/alembic/intern/abc_reader_nurbs.cc
===================================================================
diff --git a/.clang-tidy b/.clang-tidy
index 92926de9eca..0433e298826 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -40,7 +40,6 @@ Checks: >
-modernize-use-equals-default,
-modernize-use-nullptr,
-modernize-concat-nested-namespaces,
- -modernize-use-emplace,
-modernize-use-nodiscard,
-modernize-use-using,
-modernize-use-bool-literals,
diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp
index 0467e057642..fce960c216b 100644
--- a/source/blender/freestyle/intern/application/Controller.cpp
+++ b/source/blender/freestyle/intern/application/Controller.cpp
@@ -350,7 +350,7 @@ int Controller::LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph
string basename = string(cleaned);
#endif
- _ListOfModels.push_back("Blender_models");
+ _ListOfModels.emplace_back("Blender_models");
_Scene3dBBox = _RootNode->bbox();
diff --git a/source/blender/freestyle/intern/geometry/Bezier.cpp b/source/blender/freestyle/intern/geometry/Bezier.cpp
index 4ae30ff893c..4eec3d72db9 100644
--- a/source/blender/freestyle/intern/geometry/Bezier.cpp
+++ b/source/blender/freestyle/intern/geometry/Bezier.cpp
@@ -73,8 +73,8 @@ void BezierCurveSegment::Build()
float increment = 1.0 / (float)nvertices;
float t = 0.0f;
for (int i = 0; i <= nvertices; ++i) {
- _Vertices.push_back(Vec2d((x[3] + t * (x[2] + t * (x[1] + t * x[0]))),
- (y[3] + t * (y[2] + t * (y[1] + t * y[0])))));
+ _Vertices.emplace_back((x[3] + t * (x[2] + t * (x[1] + t * x[0]))),
+ (y[3] + t * (y[2] + t * (y[1] + t * y[0]))));
t += increment;
}
}
diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp
index aeb4902e5b0..5682ccc9298 100644
--- a/source/blender/freestyle/intern/geometry/FitCurve.cpp
+++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp
@@ -493,7 +493,7 @@ void FitCurveWrapper::FitCurve(vector<Vec2d> &data, vector<Vec2d> &oCurve, doubl
// copy results
for (vector<Vector2>::iterator v = _vertices.begin(), vend = _vertices.end(); v != vend; ++v) {
- oCurve.push_back(Vec2d(v->x(), v->y()));
+ oCurve.emplace_back(v->x(), v->y());
}
}
diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
index 76e63764e4d..b1d0a6c7e2a 100644
--- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
@@ -54,8 +54,7 @@ void GeomCleaner::SortIndexedVertexArray(const float *iVertices,
list<IndexedVertex> indexedVertices;
unsigned i;
for (i = 0; i < iVSize; i += 3) {
- indexedVertices.push_back(
- IndexedVertex(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]), i / 3));
+ indexedVertices.emplace_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]), i / 3);
}
// q-sort
@@ -99,7 +98,7 @@ void GeomCleaner::CompressIndexedVertexArray(const float *iVertices,
vector<Vec3f> vertices;
unsigned i;
for (i = 0; i < iVSize; i += 3) {
- vertices.push_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]));
+ vertices.emplace_back(iVertices[i], iVertices[i + 1], iVertices[i + 2]);
}
unsigned *mapVertex = new unsigned[iVSize];
@@ -207,7 +206,7 @@ void GeomCleaner::CleanIndexedVertexArray(const float *iVertices,
vector<Vec3f> vertices;
unsigned i;
for (i = 0; i < iVSize; i += 3) {
- vertices.push_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]));
+ vertices.emplace_back(iVertices[i], iVertices[i + 1], iVertices[i + 2]);
}
cleanHashTable ht;
diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
index 0d4f21d9b11..af247851911 100644
--- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
+++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
@@ -384,13 +384,13 @@ int BezierCurveShader::shade(Stroke &stroke) const
// Build the Bezier curve from this set of data points:
vector<Vec2d> data;
StrokeInternal::StrokeVertexIterator v = stroke.strokeVerticesBegin(), vend;
- data.push_back(Vec2d(v->x(), v->y())); // first one
+ data.emplace_back(v->x(), v->y()); // first one
StrokeInternal::StrokeVertexIterator previous = v;
++v;
for (vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
if (!((fabs(v->x() - (previous)->x()) < M_EPSILON) &&
((fabs(v->y() - (previous)->y()) < M_EPSILON)))) {
- data.push_back(Vec2d(v->x(), v->y()));
+ data.emplace_back(v->x(), v->y());
}
previous = v;
}
diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp
index 3e1463e8631..2e50465d5c0 100644
--- a/source/blender/freestyle/intern/stroke/Stroke.cpp
+++ b/source/blender/freestyle/intern/stroke/Stroke.cpp
@@ -562,7 +562,7 @@ int Stroke::Resample(int iNPoints)
real norm_var = vec_tmp.norm();
int numberOfPointsToAdd = (int)floor(NPointsToAdd * norm_var / _Length);
float csampling = norm_var / (float)(numberOfPointsToAdd + 1);
- strokeSegments.push_back(StrokeSegment(it, next, norm_var, numberOfPointsToAdd, csampling));
+ strokeSegments.emplace_back(it, next, norm_var, numberOfPointsToAdd, csampling);
N += numberOfPointsToAdd;
meanlength += norm_var;
++nsegments;
diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
index 7790dd64cf5..a5b3ce454de 100644
--- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
@@ -45,8 +45,8 @@ SteerableViewMap::SteerableViewMap(unsigned int nbOrientations)
_nbOrientations = nbOrientations;
_bound = cos(M_PI / (float)_nbOrientations);
for (unsigned int i = 0; i < _nbOrientations; ++i) {
- _directions.push_back(Vec2d(cos((float)i * M_PI / (float)_nbOrientations),
- sin((float)i * M_PI / (float)_nbOrientations)));
+ _directions.emplace_back(cos((float)i * M_PI / (float)_nbOrientations),
+ sin((float)i * M_PI / (float)_nbOrientations));
}
Build();
}
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
index 2ef01ce0874..e7d4ec6aa6e 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
@@ -566,7 +566,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
if (wFace) {
vector<Vec3r> vertices;
for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) {
- vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex()));
+ vertices.emplace_back(wFace->GetVertex(i)->GetVertex());
}
Polygon3r poly(vertices, wFace->GetNormal());
poly.userdata = (void *)wFace;
@@ -764,7 +764,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap,
if (wFace) {
vector<Vec3r> vertices;
for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) {
- vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex()));
+ vertices.emplace_back(wFace->GetVertex(i)->GetVertex());
}
Polygon3r poly(vertices, wFace->GetNormal());
poly.userdata = (void *)wFace;
@@ -918,7 +918,7 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon)
if (wFace) {
vector<Vec3r> vertices;
for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) {
- vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex()));
+ vertices.emplace_back(wFace->GetVertex(i)->GetVertex());
}
Polygon3r poly(vertices, wFace->GetNormal());
poly.userdata = (void *)wFace;
@@ -1002,7 +1002,7 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon)
if (wFace) {
vector<Vec3r> vertices;
for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) {
- vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex()));
+ vertices.emplace_back(wFace->GetVertex(i)->GetVertex());
}
Polygon3r poly(vertices, wFace->GetNormal());
poly.userdata = (void *)wFace;
diff --git a/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp b/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp
index f54b54f5a3a..9898255aaa7 100644
--- a/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp
@@ -42,7 +42,7 @@ void WFillGrid::fillGrid()
(*f)->RetrieveVertexList(fvertices);
for (vector<WVertex *>::const_iterator wv = fvertices.begin(); wv != fvertices.end(); ++wv) {
- vectors.push_back(Vec3r((*wv)->GetVertex()));
+ vectors.emplace_back((*wv)->GetVertex());
}
// occluder will be deleted by the grid
diff --git a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp
index e1cb1c29f63..3ca021ec2c6 100644
--- a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp
@@ -42,7 +42,7 @@ void WSFillGrid::fillGrid()
(*f)->RetrieveVertexList(fvertices);
for (vector<WVertex *>::const_iterator wv = fvertices.begin(); wv != fvertices.end(); ++wv) {
- vectors.push_back(Vec3r((*wv)->GetVertex()));
+ vectors.emplace_back((*wv)->GetVertex());
}
// occluder will be deleted by the grid
diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
index c989d77a730..0fefb15f887 100644
--- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
@@ -282,23 +282
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list