aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
diff options
context:
space:
mode:
authorRichard <legalize@xmission.com>2021-12-30 15:41:27 -0700
committerRichard <legalize@xmission.com>2022-01-28 16:09:46 -0700
commit99217fa8a027a893a9b2f46ed315ec4cab850e3d (patch)
tree4eb6481fb529ae326ccb3cf395a8f2b2850cc9af /clang/lib/Frontend/InitPreprocessor.cpp
parent5fc1261ef37549484e9eb9edc90477d713d8223f (diff)
downloadllvm-99217fa8a027a893a9b2f46ed315ec4cab850e3d.zip
llvm-99217fa8a027a893a9b2f46ed315ec4cab850e3d.tar.gz
llvm-99217fa8a027a893a9b2f46ed315ec4cab850e3d.tar.bz2
[clang-tidy] Recognize labelled statements when simplifying boolean exprs
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
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
0 files changed, 0 insertions, 0 deletions