Forrest logo
tool overview
On this page you find all important commands for the CLI tool clang-tidy. If the command you are looking for is missing please ask our AI.

clang-tidy

clang-tidy is a command line tool that is part of the Clang family of tools. It is designed to help developers improve their code quality by providing various static analysis checks, code corrections, and code style suggestions. It performs detailed analysis of C and C++ source code, identifying potential bugs, design issues, and performance problems.

Clang-tidy works by applying a set of predefined or custom rules to the source code. These rules cover a wide range of areas, including coding standards, modern C++ best practices, security vulnerabilities, and potential performance improvements. It can also integrate with popular IDEs, such as Visual Studio Code or CLion, to provide real-time feedback as you write code.

When running clang-tidy, you can specify the source files or compile commands, and it will generate a report containing identified issues along with suggested fixes. The tool can be configured to automatically apply some of the corrections or just provide recommendations for manual implementation.

Using clang-tidy can help developers identify potential issues early in the development process and maintain a consistent codebase. It can be integrated into continuous integration workflows to enforce code quality standards and prevent the introduction of new issues. Overall, clang-tidy is a powerful tool for developers working with C and C++, offering automated code analysis, suggestions, and refactorings to improve code quality and maintainability.

List of commands for clang-tidy:

  • clang-tidy:tldr:2e155 clang-tidy: List all available checks.
    $ clang-tidy -checks=${*} -list-checks
    try on your machine
    explain this command
  • clang-tidy:tldr:7ed8c clang-tidy: Run default checks on a source file.
    $ clang-tidy ${filename-cpp}
    try on your machine
    explain this command
  • clang-tidy:tldr:f760a clang-tidy: Don't run any checks other than the `cppcoreguidelines` checks on a file.
    $ clang-tidy ${filename-cpp} -checks=${-*,cppcoreguidelines-*}
    try on your machine
    explain this command
tool overview