[clang-tidy] enhance modernize-use-bool-literals to check ternary operator
authorKirill Bobyrev <omtcyfz@gmail.com>
Mon, 8 Aug 2016 17:11:56 +0000 (17:11 +0000)
committerKirill Bobyrev <omtcyfz@gmail.com>
Mon, 8 Aug 2016 17:11:56 +0000 (17:11 +0000)
commit75de8968b6252611a2319136342cd3b35eac2f85
treea060e9fb5728f4d5b5b8ff97f20539ef29f9e2a7
parentb07109275642f9ddafc10426cedee30d7ad5b74a
[clang-tidy] enhance modernize-use-bool-literals to check ternary operator

modernize-use-bool-literals doesn't checks operands in ternary operator.

For example:

``` c++
static int Value = 1;

bool foo() {
  bool Result = Value == 1 ? 1 : 0;
  return Result;
}

bool boo() {
  return Value == 1 ? 1 : 0;
}
```

This issue was reported in bug 28854. The patch fixes it.

Reviewers: alexfh, aaron.ballman, Prazek

Subscribers: Prazek, Eugene.Zelenko

Differential Revision: https://reviews.llvm.org/D23243

llvm-svn: 278022
clang-tools-extra/clang-tidy/modernize/UseBoolLiteralsCheck.cpp
clang-tools-extra/docs/clang-tidy/checks/modernize-use-bool-literals.rst
clang-tools-extra/test/clang-tidy/modernize-use-bool-literals.cpp