Skip to content

clang-debug does not build on master: two clang-tidy errors the Check clang-tidy job never reports #608

Description

@christianparpart

Problem

cmake --build --preset clang-debug fails on a clean master. The preset sets CXX_CLANG_TIDY on the Lightweight and LightweightTools targets, so clang-tidy runs during compilation and WarningsAsErrors turns two findings into hard errors:

src/Lightweight/DataMapper/DataMapper.hpp:3071:18: error: function 'PreloadHasMany' has
    cognitive complexity of 28 (threshold 25) [readability-function-cognitive-complexity]

src/Lightweight/DataMapper/Pool.hpp:272:5: error: Potential leak of memory pointed to by
    field '_M_head_impl' [clang-analyzer-cplusplus.NewDeleteLeaks]

Reproduced with clang-tidy 22.1.8 and again with -D CMAKE_CXX_COMPILER=clang++-22, matching CLANG_TOOLS_VERSION. Confirmed pre-existing: both still appear with an unrelated in-flight branch's changes stashed.

Why CI is green

The Check clang-tidy job never builds. It configures the preset only, then runs run-clang-tidy over the compile database:

- run: cmake --preset clang-debug -D CMAKE_CXX_COMPILER=clang++-22 ... -B build
- run: run-clang-tidy-22 -p ./build -clang-tidy-binary clang-tidy-22 -config-file .clang-tidy \
         -header-filter='...' -source-filter='^(?!.*_deps/).*$'

That invocation does not report either finding, so the job passes while the preset a developer would actually run is red. Two checks that are both nominally "clang-tidy" therefore disagree.

Suggested triage

  • Pool.hpp:272 — decide whether it is a true positive. The analyzer claims a leak on a unique_ptr-held pointer; if genuine it is a real connection-pool leak and the more urgent half of this issue, and it is not covered by any test.
  • DataMapper.hpp:3071 — a threshold breach; either split PreloadHasMany or raise the limit deliberately.
  • Separately, decide which invocation is authoritative. If the build-time one is, the CI job should build the targets so the gate matches local behaviour; if run-clang-tidy is, CXX_CLANG_TIDY in the preset is a trap that makes clang-debug unusable.

Context

Found while working on #606. That PR's own clang-tidy findings were fixed there; these two are untouched and pre-existing, so they are filed rather than folded in.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions