[clang-tools-extra] r285721 - [Clang-tidy] Fix copy-paste error in misc-redundant-expression detected by PVS-Studio

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 1 12:12:08 PDT 2016


On Tue, Nov 1, 2016 at 2:59 PM, Eugene Zelenko via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> Hi, Aaron!
>
> I don't think that it worth to split such trivial changes in three.

Unrelated changes should always go in as separate patches. This is
especially important for code archaeology and times when we have to
revert because a change is problematic.

~Aaron

>
> Eugene.
>
> On Tue, Nov 1, 2016 at 11:51 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
>> On Tue, Nov 1, 2016 at 2:33 PM, Eugene Zelenko via cfe-commits
>> <cfe-commits at lists.llvm.org> wrote:
>>> Author: eugenezelenko
>>> Date: Tue Nov  1 13:33:50 2016
>>> New Revision: 285721
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=285721&view=rev
>>> Log:
>>> [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.
>>
>> The review thread mentioned that this was supposed to be commit as
>> three separate commits rather than a single one. Can you please revert
>> this change, and then commit the logically distinct parts as separate
>> commits?
>>
>> Thanks!
>>
>> ~Aaron
>>
>>>
>>> Differential revision: https://reviews.llvm.org/D26176
>>>
>>> Modified:
>>>     clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp?rev=285721&r1=285720&r2=285721&view=diff
>>> ==============================================================================
>>> --- clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/misc/RedundantExpressionCheck.cpp Tue Nov  1 13:33:50 2016
>>> @@ -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(BinaryOpe
>>>    }
>>>
>>>    // 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(co
>>>      // Operand received with implicit comparator (cast).
>>>      Opcode = BO_NE;
>>>      OperandExpr = Cast;
>>> -    Value = APSInt(32, 0);
>>> +    Value = APSInt(32, false);
>>>    } else {
>>>      return false;
>>>    }
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list