From cafaa1c153e60edbca09151290908e9414182af0 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Sat, 8 Apr 2023 12:51:35 -0600 Subject: [PATCH] Add clang-tidy `performance-*` checks --- .clang-tidy | 3 +++ test/Graphics/Texture.test.cpp | 2 +- test/Graphics/VertexBuffer.test.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 34f52d9d8..06c3cdf3e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,6 +3,7 @@ Checks: > clang-analyzer-*, misc-*, modernize-*, + performance-*, portability-*, readability-*, -clang-analyzer-nullability.NullablePassedToNonnull, @@ -20,6 +21,8 @@ Checks: > -modernize-return-braced-init-list, -modernize-use-nodiscard, -modernize-use-trailing-return-type, + -performance-inefficient-string-concatenation, + -performance-no-int-to-ptr, -readability-braces-around-statements, -readability-container-contains, -readability-convert-member-functions-to-static, diff --git a/test/Graphics/Texture.test.cpp b/test/Graphics/Texture.test.cpp index 25b0f1f1e..998ac1a59 100644 --- a/test/Graphics/Texture.test.cpp +++ b/test/Graphics/Texture.test.cpp @@ -61,7 +61,7 @@ TEST_CASE("[Graphics] sf::Texture" * doctest::skip(skipDisplayTests)) SUBCASE("Construction") { - const sf::Texture textureCopy(texture); + const sf::Texture textureCopy(texture); // NOLINT(performance-unnecessary-copy-initialization) REQUIRE(textureCopy.getSize() == sf::Vector2u(1, 2)); CHECK(textureCopy.copyToImage().getPixel(sf::Vector2u(0, 1)) == sf::Color::Red); } diff --git a/test/Graphics/VertexBuffer.test.cpp b/test/Graphics/VertexBuffer.test.cpp index 2d3521427..4b2b9969c 100644 --- a/test/Graphics/VertexBuffer.test.cpp +++ b/test/Graphics/VertexBuffer.test.cpp @@ -69,7 +69,7 @@ TEST_CASE("[Graphics] sf::VertexBuffer" * doctest::skip(true)) SUBCASE("Construction") { - const sf::VertexBuffer vertexBufferCopy(vertexBuffer); + const sf::VertexBuffer vertexBufferCopy(vertexBuffer); // NOLINT(performance-unnecessary-copy-initialization) CHECK(vertexBufferCopy.getVertexCount() == 0); CHECK(vertexBufferCopy.getNativeHandle() == 0); CHECK(vertexBufferCopy.getPrimitiveType() == sf::PrimitiveType::LineStrip);