clang-tidy是基于LLVM-Clang开发的一个能够对源代码进行静态检查的工具。通过这个列表https://clang.llvm.org/extra/clang-tidy/checks/list.html,我们能看到官方提供的各类check。比如,为了预防bug而检测明显的infinite loop和除零行为 通过执行clang-tidy -list-checks -checks=*命令,我们可以查看当前可用的所有check。
llvm最近发了18.1.0的正式版,迫不及待把clangd的二次开发内容给移植过去,但是发现增加的一个Check在clangd中没有生效,如果直接执行clang-tidy倒是有效果。 先确认配置文件是否正确,进入方法ParsedAST::build,搜索getTidyOptionsForFile,将这行打印的级别调整为Error,即将打印函数替换为elog,编译运行,打印出来是包含自...
中启用 clang-tidy 支持后,可以在检查面板里调整要应用的 check 项。检查面板中列出了大量的 check ...
Xmake Version 2.9.4 Operating System Version and Architecture Windows 11 23H2 22631.4037 Describe Bug Whet custom location to compile_commands.json is set (build/compile_commands.json), xmake check clang.tidy can't find it and creates ne...
Xmake Version 2.9.5 Operating System Version and Architecture Windows 11 23H2 22631.4037 Describe Bug I've noticed that the xmake check clang.tidy command doesn't check header files. As I understand, it only checks files present in compi...
好的代码一定是整洁的,并且能够帮助阅读的人快速理解和定位。好的代码可以加快应用的开发迭代速度,不必...
Remove clang-tidy check readability-misleading-indentation. This check is redundant, since we are forcing the use of braces in conditional blocks with clang-tidy check readability-braces-around-statements and clang-format will ensure that the code is well indented. The removal of this check should...
+namespace tidy { +namespace readability { + +/// \brief Checks for identifiers case mismatch. +class IdentifierCaseCheck : public ClangTidyCheck { +public: + IdentifierCaseCheck(StringRef Name, ClangTidyContext *Context); + + void storeOptions(ClangTidyOptions::OptionMap &Opts) override; ...
+using namespace clang::ast_matchers; +using namespace clang::ast_matchers::internal; + +namespace clang::tidy::modernize { + +UseIntegerSignComparisonCheck::UseIntegerSignComparisonCheck( + StringRef Name, ClangTidyContext *Context)
One of the great features of CMake/CTest/CDash is the ability to setup useful but rarely used tools to automatically run on a project and report the results to a web page. For example, valgrind is a great tool to run dynamic checks on C/C++ code catching