From 869a43267c6ba3083b6c9134ebd6f2bbd6a4f63c Mon Sep 17 00:00:00 2001 From: Ashley Rogers Date: Fri, 20 Dec 2024 15:30:31 -0500 Subject: [PATCH] Undo trivially constructable std::move removals --- .clang-tidy | 2 ++ Cesium3DTilesContent/src/I3dmToGltfConverter.cpp | 4 ++-- Cesium3DTilesContent/src/PntsToGltfConverter.cpp | 2 +- Cesium3DTilesContent/src/SubtreeAvailability.cpp | 2 +- .../src/ImplicitQuadtreeLoader.cpp | 6 +++--- .../src/LayerJsonTerrainLoader.cpp | 8 ++++---- Cesium3DTilesSelection/src/TilesetHeightQuery.cpp | 4 ++-- Cesium3DTilesSelection/src/TilesetJsonLoader.cpp | 12 ++++++------ CesiumGltfContent/src/GltfUtilities.cpp | 12 ++++++------ CesiumRasterOverlays/src/RasterOverlayUtilities.cpp | 4 ++-- .../src/WebMapServiceRasterOverlay.cpp | 8 ++++---- 11 files changed, 33 insertions(+), 31 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 198e2556a..45c64ccf5 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -141,6 +141,8 @@ CheckOptions: value: "true" - key: misc-include-cleaner.IgnoreHeaders value: ".*cesium-async\\+\\+\\.h;.*bits\/.*.h" + - key: performance-move-const-arg.CheckTriviallyCopyableMove + value: "false" HeaderFilterRegex: ".*" HeaderFileExtensions: ["h"] ExcludeHeaderFilterRegex: ".*\\.ezvcpkg\/.*" diff --git a/Cesium3DTilesContent/src/I3dmToGltfConverter.cpp b/Cesium3DTilesContent/src/I3dmToGltfConverter.cpp index 9bc7db497..425078798 100644 --- a/Cesium3DTilesContent/src/I3dmToGltfConverter.cpp +++ b/Cesium3DTilesContent/src/I3dmToGltfConverter.cpp @@ -430,8 +430,8 @@ CesiumAsync::Future convertI3dmContent( decodedInstances.rotations.begin(), [](auto&& upOct, auto&& rightOct) { return rotationFromUpRight( - decodeOct32P(reinterpret_cast(upOct)), - decodeOct32P(reinterpret_cast(rightOct))); + decodeOct32P(upOct), + decodeOct32P(rightOct)); }); } else if (decodedInstances.rotationENU) { glm::dmat4 worldTransform = assetFetcher.tileTransform; diff --git a/Cesium3DTilesContent/src/PntsToGltfConverter.cpp b/Cesium3DTilesContent/src/PntsToGltfConverter.cpp index dac238d42..810beab6a 100644 --- a/Cesium3DTilesContent/src/PntsToGltfConverter.cpp +++ b/Cesium3DTilesContent/src/PntsToGltfConverter.cpp @@ -894,7 +894,7 @@ void decodeDracoMetadata( const auto& dracoMetadataSemantics = parsedContent.dracoMetadataSemantics; for (const auto& dracoMetadataSemantic : dracoMetadataSemantics) { - DracoMetadataSemantic dracoSemantic = dracoMetadataSemantic.second; + const DracoMetadataSemantic& dracoSemantic = dracoMetadataSemantic.second; draco::PointAttribute* pAttribute = pPointCloud->attribute(dracoSemantic.dracoId); if (!validateDracoMetadataAttribute(pAttribute, dracoSemantic)) { diff --git a/Cesium3DTilesContent/src/SubtreeAvailability.cpp b/Cesium3DTilesContent/src/SubtreeAvailability.cpp index e7c71b20a..b1ab7e233 100644 --- a/Cesium3DTilesContent/src/SubtreeAvailability.cpp +++ b/Cesium3DTilesContent/src/SubtreeAvailability.cpp @@ -119,7 +119,7 @@ std::optional parseAvailabilityView( subtree.buffers, subtree.bufferViews); if (maybeAvailability) { - contentAvailability.emplace_back(*maybeAvailability); + contentAvailability.emplace_back(std::move(*maybeAvailability)); } } diff --git a/Cesium3DTilesSelection/src/ImplicitQuadtreeLoader.cpp b/Cesium3DTilesSelection/src/ImplicitQuadtreeLoader.cpp index 069953853..f6c16a5c8 100644 --- a/Cesium3DTilesSelection/src/ImplicitQuadtreeLoader.cpp +++ b/Cesium3DTilesSelection/src/ImplicitQuadtreeLoader.cpp @@ -215,13 +215,13 @@ CesiumAsync::Future requestTileContent( [ellipsoid, pLogger, tileUrl, - pAssetAccessor, + pAssetAccessor = std::move(pAssetAccessor), pCompletedRequest](GltfConverterResult&& result) mutable { // Report any errors if there are any logTileLoadResult(pLogger, tileUrl, result.errors); if (result.errors || !result.model) { return TileLoadResult::createFailedResult( - pAssetAccessor, + std::move(pAssetAccessor), std::move(pCompletedRequest)); } @@ -231,7 +231,7 @@ CesiumAsync::Future requestTileContent( std::nullopt, std::nullopt, std::nullopt, - pAssetAccessor, + std::move(pAssetAccessor), std::move(pCompletedRequest), {}, TileLoadResultState::Success, diff --git a/Cesium3DTilesSelection/src/LayerJsonTerrainLoader.cpp b/Cesium3DTilesSelection/src/LayerJsonTerrainLoader.cpp index f90a5bb7f..b2e4c46e0 100644 --- a/Cesium3DTilesSelection/src/LayerJsonTerrainLoader.cpp +++ b/Cesium3DTilesSelection/src/LayerJsonTerrainLoader.cpp @@ -899,7 +899,7 @@ LayerJsonTerrainLoader::loadTileContent(const TileLoadInput& loadInput) { return std::move(finalFuture) .thenInMainThread([this, asyncSystem, - pAssetAccessor, + pAssetAccessor = std::move(pAssetAccessor), ellipsoid, ¤tLayer, &tile, @@ -919,7 +919,7 @@ LayerJsonTerrainLoader::loadTileContent(const TileLoadInput& loadInput) { // thread based on the projection of the loader since the upsampler // needs this UV to do the upsampling auto finalResult = convertToTileLoadResult( - pAssetAccessor, + std::move(pAssetAccessor), std::move(loadResult), ellipsoid); bool doesTileHaveUpsampledChild = tileHasUpsampledChild(tile); @@ -946,7 +946,7 @@ LayerJsonTerrainLoader::loadTileContent(const TileLoadInput& loadInput) { bool doesTileHaveUpsampledChild = tileHasUpsampledChild(tile); return std::move(futureQuantizedMesh) .thenImmediately( - [pAssetAccessor, + [pAssetAccessor = std::move(pAssetAccessor), doesTileHaveUpsampledChild, projection = this->_projection, tileTransform = tile.getTransform(), @@ -957,7 +957,7 @@ LayerJsonTerrainLoader::loadTileContent(const TileLoadInput& loadInput) { // based on the projection of the loader since the upsampler needs // this UV to do the upsampling auto result = convertToTileLoadResult( - pAssetAccessor, + std::move(pAssetAccessor), std::move(loadResult), ellipsoid); if (doesTileHaveUpsampledChild && diff --git a/Cesium3DTilesSelection/src/TilesetHeightQuery.cpp b/Cesium3DTilesSelection/src/TilesetHeightQuery.cpp index cb3155272..170eaa6e6 100644 --- a/Cesium3DTilesSelection/src/TilesetHeightQuery.cpp +++ b/Cesium3DTilesSelection/src/TilesetHeightQuery.cpp @@ -132,12 +132,12 @@ void TilesetHeightQuery::intersectVisibleTile( // Set ray info to this hit if closer, or the first hit if (!this->intersection.has_value()) { - this->intersection = gltfIntersectResult.hit; + this->intersection = std::move(gltfIntersectResult.hit); } else { double prevDistSq = this->intersection->rayToWorldPointDistanceSq; double thisDistSq = intersection->rayToWorldPointDistanceSq; if (thisDistSq < prevDistSq) - this->intersection = gltfIntersectResult.hit; + this->intersection = std::move(gltfIntersectResult.hit); } } diff --git a/Cesium3DTilesSelection/src/TilesetJsonLoader.cpp b/Cesium3DTilesSelection/src/TilesetJsonLoader.cpp index 38768485f..7cfcd5c9e 100644 --- a/Cesium3DTilesSelection/src/TilesetJsonLoader.cpp +++ b/Cesium3DTilesSelection/src/TilesetJsonLoader.cpp @@ -996,12 +996,12 @@ TilesetJsonLoader::loadTileContent(const TileLoadInput& loadInput) { upAxis, tileUrl, pAssetAccessor = std::move(pAssetAccessor), - pCompletedRequest](GltfConverterResult&& result) { + pCompletedRequest = std::move(pCompletedRequest)](GltfConverterResult&& result) { logTileLoadResult(pLogger, tileUrl, result.errors); if (result.errors) { return TileLoadResult::createFailedResult( - pAssetAccessor, - pCompletedRequest); + std::move(pAssetAccessor), + std::move(pCompletedRequest)); } return TileLoadResult{ std::move(*result.model), @@ -1009,8 +1009,8 @@ TilesetJsonLoader::loadTileContent(const TileLoadInput& loadInput) { std::nullopt, std::nullopt, std::nullopt, - pAssetAccessor, - pCompletedRequest, + std::move(pAssetAccessor), + std::move(pCompletedRequest), {}, TileLoadResultState::Success, ellipsoid}; @@ -1023,7 +1023,7 @@ TilesetJsonLoader::loadTileContent(const TileLoadInput& loadInput) { upAxis, tileRefine, pLogger, - pAssetAccessor, + std::move(pAssetAccessor), std::move(pCompletedRequest), std::move(externalContentInitializer), ellipsoid)); diff --git a/CesiumGltfContent/src/GltfUtilities.cpp b/CesiumGltfContent/src/GltfUtilities.cpp index 1282c7e55..adb3dd802 100644 --- a/CesiumGltfContent/src/GltfUtilities.cpp +++ b/CesiumGltfContent/src/GltfUtilities.cpp @@ -1522,9 +1522,9 @@ GltfUtilities::IntersectResult GltfUtilities::intersectRayGltfModel( if (!result.hit.has_value()) { result.hit = RayGltfHit{ - *primitiveHitPoint, - primitiveToWorld, - worldPoint, + std::move(*primitiveHitPoint), + std::move(primitiveToWorld), + std::move(worldPoint), rayToWorldPointDistanceSq, meshId, primitiveId}; @@ -1533,9 +1533,9 @@ GltfUtilities::IntersectResult GltfUtilities::intersectRayGltfModel( // Use in result if it's closer if (rayToWorldPointDistanceSq < result.hit->rayToWorldPointDistanceSq) { - result.hit->primitivePoint = *primitiveHitPoint; - result.hit->primitiveToWorld = primitiveToWorld; - result.hit->worldPoint = worldPoint; + result.hit->primitivePoint = std::move(*primitiveHitPoint); + result.hit->primitiveToWorld = std::move(primitiveToWorld); + result.hit->worldPoint = std::move(worldPoint); result.hit->rayToWorldPointDistanceSq = rayToWorldPointDistanceSq; result.hit->meshId = meshId; result.hit->primitiveId = primitiveId; diff --git a/CesiumRasterOverlays/src/RasterOverlayUtilities.cpp b/CesiumRasterOverlays/src/RasterOverlayUtilities.cpp index 29f969e63..e964f8b73 100644 --- a/CesiumRasterOverlays/src/RasterOverlayUtilities.cpp +++ b/CesiumRasterOverlays/src/RasterOverlayUtilities.cpp @@ -1108,8 +1108,8 @@ bool upsamplePrimitiveForRasterOverlays( Accessor& accessor = model.accessors[static_cast(attribute.accessorIndex)]; accessor.count = numberOfVertices; - accessor.min = attribute.minimums; - accessor.max = attribute.maximums; + accessor.min = std::move(attribute.minimums); + accessor.max = std::move(attribute.maximums); } // Add an accessor for the indices diff --git a/CesiumRasterOverlays/src/WebMapServiceRasterOverlay.cpp b/CesiumRasterOverlays/src/WebMapServiceRasterOverlay.cpp index 488003ecb..57203fdee 100644 --- a/CesiumRasterOverlays/src/WebMapServiceRasterOverlay.cpp +++ b/CesiumRasterOverlays/src/WebMapServiceRasterOverlay.cpp @@ -319,7 +319,7 @@ WebMapServiceRasterOverlay::createTileProvider( if (!pResponse) { return nonstd::make_unexpected(RasterOverlayLoadFailureDetails{ RasterOverlayLoadType::TileProvider, - pRequest, + std::move(pRequest), "No response received from web map service."}); } @@ -332,7 +332,7 @@ WebMapServiceRasterOverlay::createTileProvider( if (error != tinyxml2::XMLError::XML_SUCCESS) { return nonstd::make_unexpected(RasterOverlayLoadFailureDetails{ RasterOverlayLoadType::TileProvider, - pRequest, + std::move(pRequest), "Could not parse web map service XML."}); } @@ -340,7 +340,7 @@ WebMapServiceRasterOverlay::createTileProvider( if (!pRoot) { return nonstd::make_unexpected(RasterOverlayLoadFailureDetails{ RasterOverlayLoadType::TileProvider, - pRequest, + std::move(pRequest), "Web map service XML document does not have a root " "element."}); } @@ -349,7 +349,7 @@ WebMapServiceRasterOverlay::createTileProvider( if (!validateCapabilities(pRoot, options, validationError)) { return nonstd::make_unexpected(RasterOverlayLoadFailureDetails{ RasterOverlayLoadType::TileProvider, - pRequest, + std::move(pRequest), validationError}); }