Skip to content

Commit

Permalink
[Clang-tidy] Fix copy-paste error in misc-redundant-expression detect…
Browse files Browse the repository at this point in the history
…ed by PVS-Studio

Also fix some Include What You Use and modernize-use-bool-literals warnings.

Differential revision: https://reviews.llvm.org/D26176

llvm-svn: 285721
  • Loading branch information
EugeneZelenko committed Nov 1, 2016
1 parent 035c4f1 commit 90c117a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
Expand Up @@ -12,7 +12,20 @@
#include "../utils/OptionsUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/Support/Casting.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
#include <set>
#include <string>
#include <vector>

using namespace clang::ast_matchers;
using namespace clang::tidy::matchers;
Expand Down Expand Up @@ -171,7 +184,7 @@ static bool areExclusiveRanges(BinaryOperatorKind OpcodeLHS,
}

// Handle cases where the constants are different.
if ((OpcodeLHS == BO_EQ || OpcodeLHS == BO_LE || OpcodeLHS == BO_LE) &&
if ((OpcodeLHS == BO_EQ || OpcodeLHS == BO_LT || OpcodeLHS == BO_LE) &&
(OpcodeRHS == BO_EQ || OpcodeRHS == BO_GT || OpcodeRHS == BO_GE))
return true;

Expand Down Expand Up @@ -401,7 +414,7 @@ retrieveRelationalIntegerConstantExpr(const MatchFinder::MatchResult &Result,
// Operand received with implicit comparator (cast).
Opcode = BO_NE;
OperandExpr = Cast;
Value = APSInt(32, 0);
Value = APSInt(32, false);
} else {
return false;
}
Expand Down

0 comments on commit 90c117a

Please sign in to comment.