diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbe9a16e..214bb698 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -480,17 +480,17 @@ jobs: clang-tidy: needs: clang name: Clang-Tidy - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Install - run: sudo apt-get install -y clang-tidy cmake ninja-build + run: sudo apt-get install -y clang-tidy libc++-dev libc++abi-dev - name: Checkout uses: actions/checkout@v4 - name: Configure - run: cmake -G Ninja -DCMAKE_CXX_CLANG_TIDY="clang-tidy-10;--warnings-as-errors=*" -DCMAKE_BUILD_TYPE=Debug . + run: cmake -G Ninja -DCMAKE_CXX_CLANG_TIDY="clang-tidy;--warnings-as-errors=*" -DCMAKE_BUILD_TYPE=Debug . env: - CC: clang-10 - CXX: clang++-10 + CC: clang + CXX: clang++ - name: Check run: cmake --build . -- -k 0 diff --git a/extras/tests/JsonDocument/assignment.cpp b/extras/tests/JsonDocument/assignment.cpp index 4e59584c..64d7dd02 100644 --- a/extras/tests/JsonDocument/assignment.cpp +++ b/extras/tests/JsonDocument/assignment.cpp @@ -69,6 +69,8 @@ TEST_CASE("JsonDocument assignment") { doc2 = std::move(doc1); REQUIRE(doc2.as() == "{\"hello\":\"world\"}"); + + // NOLINTNEXTLINE(clang-analyzer-cplusplus.Move) REQUIRE(doc1.as() == "null"); } REQUIRE(spyingAllocator.log() == AllocatorLog{ diff --git a/extras/tests/JsonDocument/constructor.cpp b/extras/tests/JsonDocument/constructor.cpp index 1eaec202..371a2561 100644 --- a/extras/tests/JsonDocument/constructor.cpp +++ b/extras/tests/JsonDocument/constructor.cpp @@ -44,6 +44,8 @@ TEST_CASE("JsonDocument constructor") { JsonDocument doc2(std::move(doc1)); REQUIRE(doc2.as() == "The size of this string is 32!!"); + + // NOLINTNEXTLINE(clang-analyzer-cplusplus.Move) REQUIRE(doc1.as() == "null"); } REQUIRE(spyingAllocator.log() == AllocatorLog{ diff --git a/extras/tests/ResourceManager/StringBuilder.cpp b/extras/tests/ResourceManager/StringBuilder.cpp index a63661bd..5c6dd220 100644 --- a/extras/tests/ResourceManager/StringBuilder.cpp +++ b/extras/tests/ResourceManager/StringBuilder.cpp @@ -116,12 +116,12 @@ TEST_CASE("StringBuilder") { } } -static JsonString saveString(StringBuilder& builder, const char* s) { +static VariantData saveString(StringBuilder& builder, const char* s) { VariantData data; builder.startString(); builder.append(s); builder.save(&data); - return data.asString(); + return data; } TEST_CASE("StringBuilder::save() deduplicates strings") { @@ -134,9 +134,9 @@ TEST_CASE("StringBuilder::save() deduplicates strings") { auto s2 = saveString(builder, "world"); auto s3 = saveString(builder, "hello"); - REQUIRE(s1 == "hello"); - REQUIRE(s2 == "world"); - REQUIRE(+s1.c_str() == +s3.c_str()); // same address + REQUIRE(s1.asString() == "hello"); + REQUIRE(s2.asString() == "world"); + REQUIRE(+s1.asString().c_str() == +s3.asString().c_str()); // same address REQUIRE(spy.log() == AllocatorLog{ @@ -152,9 +152,10 @@ TEST_CASE("StringBuilder::save() deduplicates strings") { auto s1 = saveString(builder, "hello world"); auto s2 = saveString(builder, "hello"); - REQUIRE(s1 == "hello world"); - REQUIRE(s2 == "hello"); - REQUIRE(+s2.c_str() != +s1.c_str()); // different address + REQUIRE(s1.asString() == "hello world"); + REQUIRE(s2.asString() == "hello"); + REQUIRE(+s2.asString().c_str() != + +s1.asString().c_str()); // different address REQUIRE(spy.log() == AllocatorLog{ @@ -169,9 +170,10 @@ TEST_CASE("StringBuilder::save() deduplicates strings") { auto s1 = saveString(builder, "hello world"); auto s2 = saveString(builder, "worl"); - REQUIRE(s1 == "hello world"); - REQUIRE(s2 == "worl"); - REQUIRE(s2.c_str() != s1.c_str()); // different address + REQUIRE(s1.asString() == "hello world"); + REQUIRE(s2.asString() == "worl"); + REQUIRE(s2.asString().c_str() != + s1.asString().c_str()); // different address REQUIRE(spy.log() == AllocatorLog{