[clang-tools-extra] r330492 - [clang-tidy] add new check to find out objc ivars which do not have prefix '_'

Chandler Carruth via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 21 16:32:20 PDT 2018


Ok, this still isn't fixed a day later and over half our build bots are red
because of it. =/ I tried just applying the patch, and it doesn't seem to
fully fix the test as it results in a different error...

I've reverted in r330528 for now so that our bots are green. =] Feel free
to re-land once you've confirmed the tests are passing, and keep an eye on
the bots after it goes in. =D

On Fri, Apr 20, 2018 at 11:33 PM Chandler Carruth <chandlerc at gmail.com>
wrote:

> I see Alex already got it, but in the future, that kind of trivial test
> fix for a failing test is fine to just land, and it is more important to
> get the bots healthy. =]
>
> On Fri, Apr 20, 2018, 22:14 Yan Zhang via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> https://reviews.llvm.org/D45912 need someone to accept
>>
>> Best regards
>> Yan Zhang
>>
>> On Apr 20, 2018, at 19:08, Chandler Carruth <chandlerc at gmail.com> wrote:
>>
>> This has broken most of the build bots. Are you working on a fix or
>> revert?
>>
>> Might be useful to get on the IRC channel to help coordinate this kind of
>> thing.
>>
>> On Fri, Apr 20, 2018 at 4:45 PM Yan Zhang via cfe-commits <
>> cfe-commits at lists.llvm.org> wrote:
>>
>>> Author: wizard
>>> Date: Fri Apr 20 16:18:09 2018
>>> New Revision: 330492
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=330492&view=rev
>>> Log:
>>> [clang-tidy] add new check to find out objc ivars which do not have
>>> prefix '_'
>>>
>>> Summary:
>>> For code of ivar declaration:
>>>
>>>    int barWithoutPrefix;
>>>
>>> The fix will be:
>>>
>>>    int _barWithoutPrefix;
>>>
>>> Reviewers: benhamilton, hokein, alexfh, aaron.ballman, ilya-biryukov
>>>
>>> Reviewed By: alexfh
>>>
>>> Subscribers: Eugene.Zelenko, xazax.hun, klimek, mgorny, cfe-commits
>>>
>>> Tags: #clang-tools-extra
>>>
>>> Differential Revision: https://reviews.llvm.org/D45392
>>>
>>> Added:
>>>
>>> clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m
>>> Modified:
>>>
>>> clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
>>>
>>> Modified:
>>> clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp?rev=330492&r1=330491&r2=330492&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
>>> (original)
>>> +++
>>> clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
>>> Fri Apr 20 16:18:09 2018
>>> @@ -109,6 +109,7 @@ namespace readability {
>>>      m(TemplateParameter) \
>>>      m(TypeAlias) \
>>>      m(MacroDefinition) \
>>> +    m(ObjcIvar) \
>>>
>>>  enum StyleKind {
>>>  #define ENUMERATE(v) SK_ ## v,
>>> @@ -384,6 +385,9 @@ static StyleKind findStyleKind(
>>>      const NamedDecl *D,
>>>      const
>>> std::vector<llvm::Optional<IdentifierNamingCheck::NamingStyle>>
>>>          &NamingStyles) {
>>> +  if (isa<ObjCIvarDecl>(D) && NamingStyles[SK_ObjcIvar])
>>> +    return SK_ObjcIvar;
>>> +
>>>    if (isa<TypedefDecl>(D) && NamingStyles[SK_Typedef])
>>>      return SK_Typedef;
>>>
>>>
>>> Added:
>>> clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m?rev=330492&view=auto
>>>
>>> ==============================================================================
>>> ---
>>> clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m
>>> (added)
>>> +++
>>> clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m
>>> Fri Apr 20 16:18:09 2018
>>> @@ -0,0 +1,15 @@
>>> +// RUN: %check_clang_tidy %s readability-identifier-naming %t \
>>> +// RUN: -config='{CheckOptions: \
>>> +// RUN:  [{key: readability-identifier-naming.ObjcIvarPrefix, value:
>>> '_'}]}' \
>>> +// RUN: --
>>> +
>>> + at interface Foo
>>> + at end
>>> +
>>> + at interface Foo () {
>>> +    int _bar;
>>> +    int barWithoutPrefix;
>>> +    // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for
>>> objc ivar 'barWithoutPrefix' [readability-identifier-naming]
>>> +    // CHECK-FIXES: int _barWithoutPrefix;
>>> +}
>>> + at end
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180421/e90f110b/attachment.html>


More information about the cfe-commits mailing list