Clang 工具

使用 Clang-Tidy 和 Clazy 检测 C、C++ 和 Objective-C 程序中的问题。

为 Clang 工具全局配置 Clang 诊断:

  1. 选择首选项>Analyzer >Clang Tools

    分析器首选项中的 Clang 工具选项卡

  2. Clang-TidyClazy-Standalone 字段中,设置要使用的可执行文件的路径。
  3. Diagnostic configuration 字段显示要执行的检查。选择该字段的值可打开Diagnostic Configurations 对话框,在此可选择和编辑要执行的检查。

    要从 Clang-Tidy 配置文件执行检查,请选择Prefer .clang-tidy file, if present

  4. 要在运行 Clang 工具前构建项目,请选择Build the project before analysis 复选框。Clang 工具并不要求您在分析前构建项目,但它们可能会就构建过程中生成的文件缺失显示误导性警告。对于大型项目,不构建项目可能会节省一些时间。
  5. 要禁用自动分析打开的文档,请清除Analyze open files 复选框。
  6. Parallel jobs 字段中,选择并行运行的作业数量,以便在多核处理器上加快分析速度。

另请参阅 配置 Clang 诊断使用 Clang-Tidy 和 Clazy 分析代码,以及指定 Clang 工具设置

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.