[clang-tools-extra] r314808 - [clang-tidy] Fix bug 34747, streaming operators and hicpp-signed-bitwise

Juergen Ributzka via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 3 10:59:47 PDT 2017


Great! Thanks Jonas

> On Oct 3, 2017, at 10:54 AM, Jonas Toth <jonas.toth at gmail.com> wrote:
> 
> Hi Juergen,
> 
> i did already work on fixing the issue I introduced with the commits. I am currently waiting for the buildbot to catch up with the committed fix.
> 
> As far as i can see, the newer commits did actually fix (at least chapunis buildbot did go green again), but i have my eye on it.
> 
> Cheers, Jonas
> 
> Am 03.10.2017 um 19:53 schrieb Juergen Ributzka:
>> Hi Jonas,
>> 
>> this new test is failing on Green Dragon:
>> http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/39223/consoleFull#11207350448254eaf0-7326-4999-85b0-388101f2d404 <http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA/39223/consoleFull#11207350448254eaf0-7326-4999-85b0-388101f2d404>
>> 
>> Could you please take a look?
>> 
>> Thanks
>> 
>> Cheers,
>> Juergen
>> 
>> On Tue, Oct 3, 2017 at 9:25 AM, Jonas Toth via cfe-commits <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>> wrote:
>> Author: jonastoth
>> Date: Tue Oct  3 09:25:01 2017
>> New Revision: 314808
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=314808&view=rev <http://llvm.org/viewvc/llvm-project?rev=314808&view=rev>
>> Log:
>> [clang-tidy] Fix bug 34747, streaming operators and hicpp-signed-bitwise
>> 
>> The bug happened with stream operations, that were not recognized in all cases.
>> Even there were already existing test for streaming classes, they did not catch this bug.
>> Adding the isolated example to the existing tests did not trigger the bug.
>> Therefore i created a new isolated file that did expose the bug indeed.
>> 
>> Differential: https://reviews.llvm.org/D38399 <https://reviews.llvm.org/D38399>
>> reviewed by aaron.ballman
>> 
>> Added:
>>     clang-tools-extra/trunk/test/clang-tidy/hicpp-signed-bitwise-bug34747.cpp
>> Modified:
>>     clang-tools-extra/trunk/clang-tidy/hicpp/SignedBitwiseCheck.cpp
>> 
>> Modified: clang-tools-extra/trunk/clang-tidy/hicpp/SignedBitwiseCheck.cpp
>> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/hicpp/SignedBitwiseCheck.cpp?rev=314808&r1=314807&r2=314808&view=diff <http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/hicpp/SignedBitwiseCheck.cpp?rev=314808&r1=314807&r2=314808&view=diff>
>> ==============================================================================
>> --- clang-tools-extra/trunk/clang-tidy/hicpp/SignedBitwiseCheck.cpp (original)
>> +++ clang-tools-extra/trunk/clang-tidy/hicpp/SignedBitwiseCheck.cpp Tue Oct  3 09:25:01 2017
>> @@ -27,7 +27,9 @@ void SignedBitwiseCheck::registerMatcher
>>        binaryOperator(allOf(anyOf(hasOperatorName("|"), hasOperatorName("&"),
>>                                   hasOperatorName("^"), hasOperatorName("<<"),
>>                                   hasOperatorName(">>")),
>> -                           hasEitherOperand(SignedIntegerOperand)))
>> +                           hasEitherOperand(SignedIntegerOperand),
>> +                           hasLHS(hasType(isInteger())),
>> +                           hasRHS(hasType(isInteger()))))
>>            .bind("binary_signed"),
>>        this);
>> 
>> 
>> Added: clang-tools-extra/trunk/test/clang-tidy/hicpp-signed-bitwise-bug34747.cpp
>> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/hicpp-signed-bitwise-bug34747.cpp?rev=314808&view=auto <http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/hicpp-signed-bitwise-bug34747.cpp?rev=314808&view=auto>
>> ==============================================================================
>> --- clang-tools-extra/trunk/test/clang-tidy/hicpp-signed-bitwise-bug34747.cpp (added)
>> +++ clang-tools-extra/trunk/test/clang-tidy/hicpp-signed-bitwise-bug34747.cpp Tue Oct  3 09:25:01 2017
>> @@ -0,0 +1,21 @@
>> +// RUN: %check_clang_tidy %s hicpp-signed-bitwise %t -- -- -std=c++11 | count 0
>> +
>> +// Note: this test expects no diagnostics, but FileCheck cannot handle that,
>> +// hence the use of | count 0.
>> +
>> +template <typename C>
>> +struct OutputStream {
>> +  OutputStream &operator<<(C);
>> +};
>> +
>> +template <typename C>
>> +struct foo {
>> +  typedef OutputStream<C> stream_type;
>> +  foo(stream_type &o) {
>> +    o << 'x'; // warning occured here, fixed now
>> +  }
>> +};
>> +
>> +void bar(OutputStream<signed char> &o) {
>> +  foo<signed char> f(o);
>> +}
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits>
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171003/e24f33db/attachment.html>


More information about the cfe-commits mailing list