llvm-project/clang-tools-extra/clang-tidy
Alexander Kornienko f5e72b0448 [clang-tidy] Add readability-simplify-boolean-expr check to clang-tidy
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
2015-04-10 19:26:43 +00:00
..
google [clang-tidy] Clarify message for the google-explicit-constructor check 2015-03-31 16:24:44 +00:00
llvm [clang-tidy] Refactor: Move llvm clang-tidy checks to namespace clang::tidy::llvm 2015-03-02 12:39:18 +00:00
misc [clang-tidy] Fix for llvm.org/PR23161 2015-04-10 13:55:39 +00:00
readability [clang-tidy] Add readability-simplify-boolean-expr check to clang-tidy 2015-04-10 19:26:43 +00:00
tool Make helpers static. clang-tools edition. 2015-03-23 12:49:15 +00:00
utils [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
CMakeLists.txt [CMake] Add dependencies on clangToolingCore. 2014-10-30 00:44:01 +00:00
ClangTidy.cpp [clang-tidy] Static Analyzer checker configuration options pass-through. 2015-03-11 17:25:22 +00:00
ClangTidy.h [clang-tidy] Remove an empty destructor. 2015-03-12 12:30:10 +00:00
ClangTidyDiagnosticConsumer.cpp [clang-tidy] Count errors in ClangTidyDiagnosticConsumer 2014-11-20 12:05:51 +00:00
ClangTidyDiagnosticConsumer.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
ClangTidyModule.cpp [clang-tidy] Default options in modules. 2014-10-16 11:27:57 +00:00
ClangTidyModule.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
ClangTidyModuleRegistry.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
ClangTidyOptions.cpp [clang-tidy] Don't ignore default set of checks when a config file is found. 2015-02-05 14:50:17 +00:00
ClangTidyOptions.h [clang-tidy] Fixed header guards using clang-tidy llvm-header-guard check. NFC. 2015-03-09 16:52:33 +00:00
Makefile Add NamespaceCommentCheck to the Google module. 2014-09-22 10:41:39 +00:00
add_new_check.py [clang-tidy] Extended the example check, added a fix-it, etc. 2014-12-09 12:43:09 +00:00