Skip to content

[clang-tidy] Add AllowedTypes option to misc-const-correctness #122592

@vbvictor

Description

@vbvictor

Sometimes in large codebases we want to ignore const-correctness of certain classes because they are immutable by nature, so there is no point in adding const to them.
Minimal example:

#include <mutex>

int main() {
  std::mutex m;
  std::lock_guard<std::mutex> l(m); // check is triggered but we want to ignore it since lock_guard is already immutable.
}

Writing NOLINT for thousands of places bloats code and is not an appealing option.

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