[PATCH] D26176: [Clang-tidy] Fix copy-paste error in misc-redundant-expression detected by PVS-Studio

Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 1 11:43:29 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL285721: [Clang-tidy] Fix copy-paste error in misc-redundant-expression detected by PVSā€¦ (authored by eugenezelenko).

Changed prior to commit:
  https://reviews.llvm.org/D26176?vs=76510&id=76611#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26176

Files:
  clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp


Index: clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
+++ clang-tools-extra/trunk/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 @@
   }
 
   // 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 @@
     // Operand received with implicit comparator (cast).
     Opcode = BO_NE;
     OperandExpr = Cast;
-    Value = APSInt(32, 0);
+    Value = APSInt(32, false);
   } else {
     return false;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26176.76611.patch
Type: text/x-patch
Size: 1437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161101/539b9c14/attachment-0001.bin>


More information about the cfe-commits mailing list