From 787fcc160a9a417aeac8a69047a7148afb52dc77 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Wed, 11 May 2022 14:03:45 -0400 Subject: [PATCH] Clang-Tidy performance fixes --- code/AssetLib/3MF/XmlSerializer.cpp | 2 +- code/AssetLib/Blender/BlenderLoader.cpp | 2 +- code/AssetLib/Blender/BlenderLoader.h | 2 +- code/AssetLib/IFC/IFCOpenings.cpp | 8 ++++---- code/AssetLib/X3D/X3DImporter.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/AssetLib/3MF/XmlSerializer.cpp b/code/AssetLib/3MF/XmlSerializer.cpp index 9bd1c5bb0..740bc5658 100644 --- a/code/AssetLib/3MF/XmlSerializer.cpp +++ b/code/AssetLib/3MF/XmlSerializer.cpp @@ -106,7 +106,7 @@ bool getNodeAttribute(const XmlNode &node, const std::string &attribute, int &va return false; } -aiMatrix4x4 parseTransformMatrix(std::string matrixStr) { +aiMatrix4x4 parseTransformMatrix(const std::string& matrixStr) { // split the string std::vector numbers; std::string currentNumber; diff --git a/code/AssetLib/Blender/BlenderLoader.cpp b/code/AssetLib/Blender/BlenderLoader.cpp index b3591b4f1..2ed0d6b8a 100644 --- a/code/AssetLib/Blender/BlenderLoader.cpp +++ b/code/AssetLib/Blender/BlenderLoader.cpp @@ -281,7 +281,7 @@ void BlenderImporter::ExtractScene(Scene &out, const FileDatabase &file) { } // ------------------------------------------------------------------------------------------------ -void BlenderImporter::ParseSubCollection(const Blender::Scene &in, aiNode *root, std::shared_ptr collection, ConversionData &conv_data) { +void BlenderImporter::ParseSubCollection(const Blender::Scene &in, aiNode *root, const std::shared_ptr& collection, ConversionData &conv_data) { std::deque root_objects; // Count number of objects diff --git a/code/AssetLib/Blender/BlenderLoader.h b/code/AssetLib/Blender/BlenderLoader.h index 0299ae393..b29ee5941 100644 --- a/code/AssetLib/Blender/BlenderLoader.h +++ b/code/AssetLib/Blender/BlenderLoader.h @@ -117,7 +117,7 @@ protected: void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override; void ParseBlendFile(Blender::FileDatabase &out, std::shared_ptr stream); void ExtractScene(Blender::Scene &out, const Blender::FileDatabase &file); - void ParseSubCollection(const Blender::Scene &in, aiNode *root, std::shared_ptr collection, Blender::ConversionData &conv_data); + void ParseSubCollection(const Blender::Scene &in, aiNode *root, const std::shared_ptr& collection, Blender::ConversionData &conv_data); void ConvertBlendFile(aiScene *out, const Blender::Scene &in, const Blender::FileDatabase &file); private: diff --git a/code/AssetLib/IFC/IFCOpenings.cpp b/code/AssetLib/IFC/IFCOpenings.cpp index 6b8b565c2..3c4a0b3cd 100644 --- a/code/AssetLib/IFC/IFCOpenings.cpp +++ b/code/AssetLib/IFC/IFCOpenings.cpp @@ -1428,7 +1428,7 @@ bool GenerateOpenings(std::vector& openings, return true; } -std::vector GetContourInPlane2D(std::shared_ptr mesh,IfcMatrix3 planeSpace, +std::vector GetContourInPlane2D(const std::shared_ptr& mesh,IfcMatrix3 planeSpace, IfcVector3 planeNor,IfcFloat planeOffset, IfcVector3 extrusionDir,IfcVector3& wall_extrusion,bool& first,bool& ok) { std::vector contour; @@ -1491,7 +1491,7 @@ static void logSegment(std::pair segment) { IFCImporter::LogInfo(msg2.str().c_str()); } -std::vector> GetContoursInPlane3D(std::shared_ptr mesh,IfcMatrix3 planeSpace, +std::vector> GetContoursInPlane3D(const std::shared_ptr& mesh,IfcMatrix3 planeSpace, IfcFloat planeOffset) { { @@ -1676,7 +1676,7 @@ std::vector> GetContoursInPlane3D(std::shared_ptr> GetContoursInPlane3D(std::shared_ptr> GetContoursInPlane(std::shared_ptr mesh,IfcMatrix3 planeSpace, +std::vector> GetContoursInPlane(const std::shared_ptr& mesh,IfcMatrix3 planeSpace, IfcVector3 planeNor,IfcFloat planeOffset, IfcVector3 extrusionDir,IfcVector3& wall_extrusion,bool& first) { diff --git a/code/AssetLib/X3D/X3DImporter.cpp b/code/AssetLib/X3D/X3DImporter.cpp index b34f361ae..01c97eb4c 100644 --- a/code/AssetLib/X3D/X3DImporter.cpp +++ b/code/AssetLib/X3D/X3DImporter.cpp @@ -333,7 +333,7 @@ void X3DImporter::readHead(XmlNode &node) { } mScene->mMetaData = aiMetadata::Alloc(static_cast(metaArray.size())); unsigned int i = 0; - for (auto currentMeta : metaArray) { + for (const auto& currentMeta : metaArray) { mScene->mMetaData->Set(i, currentMeta.name, aiString(currentMeta.value)); ++i; }