forked from OSchip/llvm-project
99217fa8a0
Inside a switch the caseStmt() and defaultStmt() have a nested statement associated with them. Similarly, labelStmt() has a nested statement. These statements were being missed when looking for a compound-if of the form "if (x) return true; return false;" when the if is nested under one of these labelling constructs. Enhance the matchers to look for these nested statements using some private matcher hasSubstatement() traversal matcher on case, default and label statements. Add the private matcher hasSubstatementSequence() to match the compound "if (x) return true; return false;" pattern. - Add unit tests for private matchers and corresponding test infrastructure - Add corresponding test file readability-simplify-bool-expr-case.cpp. - Fix variable name copy/paste error in readability-simplify-bool-expr.cpp. - Drop the asserts, which were used only for debugging matchers. - Run clang-format on the whole check. - Move local functions out of anonymous namespace and declare state, per LLVM style guide - Declare labels constexpr - Declare visitor arguments as pointer to const - Drop braces around simple control statements per LLVM style guide - Prefer explicit arguments over default arguments to methods Differential Revision: https://reviews.llvm.org/D56303 Fixes #27078 |
||
---|---|---|
.. | ||
clang-apply-replacements | ||
clang-change-namespace | ||
clang-doc | ||
clang-include-fixer | ||
clang-move | ||
clang-query | ||
clang-reorder-fields | ||
clang-tidy | ||
clangd | ||
docs | ||
modularize | ||
pp-trace | ||
test | ||
tool-template | ||
unittests | ||
.gitignore | ||
CMakeLists.txt | ||
CODE_OWNERS.TXT | ||
LICENSE.TXT | ||
README.txt |
README.txt
//===----------------------------------------------------------------------===// // Clang Tools repository //===----------------------------------------------------------------------===// Welcome to the repository of extra Clang Tools. This repository holds tools that are developed as part of the LLVM compiler infrastructure project and the Clang frontend. These tools are kept in a separate "extra" repository to allow lighter weight checkouts of the core Clang codebase. This repository is only intended to be checked out inside of a full LLVM+Clang tree, and in the 'tools/extra' subdirectory of the Clang checkout. All discussion regarding Clang, Clang-based tools, and code in this repository should be held using the standard Clang mailing lists: http://lists.llvm.org/mailman/listinfo/cfe-dev Code review for this tree should take place on the standard Clang patch and commit lists: http://lists.llvm.org/mailman/listinfo/cfe-commits If you find a bug in these tools, please file it in the LLVM bug tracker: http://llvm.org/bugs/