summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/readability/SimplifyBooleanExprCheck.h
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] Switch checks to #include "ClangTidyCheck.h"Alexander Kornienko2019-03-251-1/+1
| | | | llvm-svn: 356892
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [clang-tidy] Use translationUnitDecl() instead of a custom matcher.Alexander Kornienko2018-12-201-1/+0
| | | | llvm-svn: 349758
* [clang-tidy] Update checks to play nicely with limited traversal scope added ↵Sam McCall2018-11-151-0/+1
| | | | | | | | | | | | | | in r346847 Summary: (See D54204 for original review) Reviewers: hokein Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D54579 llvm-svn: 346961
* [clang-tidy] Partly rewrite readability-simplify-boolean-expr using RAVAlexander Kornienko2017-05-151-15/+3
| | | | | | | | | | The check was using AST matchers in a very inefficient manner. By rewriting the BinaryOperator-related parts using RAV, the check was sped up by a factor of up to 10000 on some files (mostly, generated code using binary operators in tables), but also significantly sped up for regular large files. As a side effect, the code became clearer and more readable. llvm-svn: 303081
* Reapply r260096.Aaron Ballman2016-02-121-69/+2
| | | | | | | | | | | | Expand the simplify boolean expression check to handle implicit conversion of integral types to bool and improve the handling of implicit conversion of member pointers to bool. Implicit conversion of member pointers are replaced with explicit comparisons to nullptr. Implicit conversions of integral types are replaced with explicit comparisons to 0. Patch by Richard Thomson. llvm-svn: 260681
* Reverting r260096; it causes build bot failures:Aaron Ballman2016-02-081-2/+69
| | | | | | | http://bb.pgr.jp/builders/cmake-clang-tools-x86_64-linux/builds/23351 http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/492 llvm-svn: 260097
* Expand the simplify boolean expression check to handle implicit conversion ↵Aaron Ballman2016-02-081-69/+2
| | | | | | | | | | | | of integral types to bool and improve the handling of implicit conversion of member pointers to bool. Implicit conversion of member pointers are replaced with explicit comparisons to nullptr. Implicit conversions of integral types are replaced with explicit comparisons to 0. Patch by Richard Thomson. llvm-svn: 260096
* [clang-tidy] Preserve comments and preprocessor directives when simplifying ↵Alexander Kornienko2015-12-281-0/+4
| | | | | | | | | | | | | | | | | | boolean expressions This changeset still emits the diagnostic that the expression could be simplified, but it doesn't generate any fix-its that would lose comments or preprocessor directives within the text that would be replaced. Fixes PR25842 Reviewers: alexfh Subscribers: xazax.hun, cfe-commits Patch by Richard Thomson! (+a naming style fix) Differential Revision: http://reviews.llvm.org/D15737 llvm-svn: 256492
* [clang-tidy] Update docs for clang-tidy checks. NFCAlexander Kornienko2015-08-271-47/+54
| | | | | | | | | | | Changes mostly address formatting and unification of the style. Use MarkDown style for inline code snippets and lists. Added some text for a few checks. The idea is to move most of the documentation out to separate rST files and have implementation files refer to the corresponding documentation files. llvm-svn: 246169
* [clang-tidy] Enhance clang-tidy readability-simplify-boolean-expr...Alexander Kornienko2015-07-011-2/+46
| | | | | | | | | | | | | | | | | | | | Enhance clang-tidy readability-simplify-boolean-expr to handle 'if (e) return true; return false;' and improve replacement expressions. This changeset extends the simplify boolean expression check in clang-tidy to simplify if (e) return true; return false; to return e; (note the lack of an else clause on the if statement.) By default, chained conditional assignment is left unchanged, unless a configuration parameter is set to non-zero to override this behavior. It also improves the handling of replacement expressions to apply static_cast<bool>(expr) when expr is not of type bool. http://reviews.llvm.org/D9810 Patch by Richard Thomson! llvm-svn: 241155
* [clang-tidy] Enhance clang-tidy readability-simplify-boolean-expr check...Alexander Kornienko2015-05-171-5/+18
| | | | | | | | | | | | | | | | Enhance clang-tidy readability-simplify-boolean-expr check to handle chained conditional assignment and chained conditional return. Based on feedback from applying this tool to the clang/LLVM codebase, this changeset improves the readability-simplify-boolean-expr check so that conditional assignment or return statements at the end of a chain of if/else if statements are left unchanged unless a configuration option is supplied. http://reviews.llvm.org/D8996 Patch by Richard Thomson! llvm-svn: 237541
* [clang-tidy] Add readability-simplify-boolean-expr check to clang-tidyAlexander Kornienko2015-04-101-0/+101
This check looks for comparisons between boolean expressions and boolean constants and simplifies them to just use the appropriate boolean expression directly. if (b == true) becomes if (b) if (b == false) becomes if (!b) if (b && true) becomes if (b) if (b && false) becomes if (false) if (b || true) becomes if (true) if (b || false) becomes if (b) e ? true : false becomes e e ? false : true becomes !e if (true) t(); else f(); becomes t(); if (false) t(); else f(); becomes f(); if (e) return true; else return false; becomes return (e); if (e) return false; else return true; becomes return !(e); if (e) b = true; else b = false; becomes b = e; if (e) b = false; else b = true; becomes b = !(e); http://reviews.llvm.org/D7648 Patch by Richard Thomson! llvm-svn: 234626
OpenPOWER on IntegriCloud