summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Zelenko <eugene.zelenko@gmail.com>2016-11-01 18:33:50 +0000
committerEugene Zelenko <eugene.zelenko@gmail.com>2016-11-01 18:33:50 +0000
commit90c117a61b7e061c837cfb625fe0b1d1bc51707a (patch)
tree2b7f78b333c2f80f970360935fa8ad04d01c53eb
parent035c4f14e02b751f220c9f4811fb39364b1cb5cb (diff)
downloadbcm5719-llvm-90c117a61b7e061c837cfb625fe0b1d1bc51707a.tar.gz
bcm5719-llvm-90c117a61b7e061c837cfb625fe0b1d1bc51707a.zip
[Clang-tidy] Fix copy-paste error in misc-redundant-expression detected 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
-rw-r--r--clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
index 535918f4f6f..aeaeb63c8e6 100644
--- a/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/RedundantExpressionCheck.cpp
@@ -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;
@@ -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;
@@ -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;
}
OpenPOWER on IntegriCloud