[clang-tools-extra] r356220 - Fixed global constant/variable naming check on C++ class for ObjC++ files.

2019-03-14 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Thu Mar 14 17:17:41 2019
New Revision: 356220

URL: http://llvm.org/viewvc/llvm-project?rev=356220&view=rev
Log:
Fixed global constant/variable naming check on C++ class for ObjC++ files.

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D59283

Added:

clang-tools-extra/trunk/test/clang-tidy/google-objc-global-variable-declaration.mm
Modified:
clang-tools-extra/trunk/clang-tidy/google/GlobalVariableDeclarationCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/google/GlobalVariableDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/GlobalVariableDeclarationCheck.cpp?rev=356220&r1=356219&r2=356220&view=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/google/GlobalVariableDeclarationCheck.cpp 
(original)
+++ 
clang-tools-extra/trunk/clang-tidy/google/GlobalVariableDeclarationCheck.cpp 
Thu Mar 14 17:17:41 2019
@@ -79,12 +79,16 @@ void GlobalVariableDeclarationCheck::reg
 void GlobalVariableDeclarationCheck::check(
 const MatchFinder::MatchResult &Result) {
   if (const auto *Decl = Result.Nodes.getNodeAs("global_var")) {
+if (Decl->isStaticDataMember())
+  return;
 diag(Decl->getLocation(),
  "non-const global variable '%0' must have a name which starts with "
  "'g[A-Z]'")
 << Decl->getName() << generateFixItHint(Decl, false);
   }
   if (const auto *Decl = Result.Nodes.getNodeAs("global_const")) {
+if (Decl->isStaticDataMember())
+  return;
 diag(Decl->getLocation(),
  "const global variable '%0' must have a name which starts with "
  "an appropriate prefix")

Added: 
clang-tools-extra/trunk/test/clang-tidy/google-objc-global-variable-declaration.mm
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/google-objc-global-variable-declaration.mm?rev=356220&view=auto
==
--- 
clang-tools-extra/trunk/test/clang-tidy/google-objc-global-variable-declaration.mm
 (added)
+++ 
clang-tools-extra/trunk/test/clang-tidy/google-objc-global-variable-declaration.mm
 Thu Mar 14 17:17:41 2019
@@ -0,0 +1,10 @@
+// RUN: %check_clang_tidy %s google-objc-global-variable-declaration %t
+
+@class NSString;
+static NSString* const myConstString = @"hello";
+// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: const global variable 
'myConstString' must have a name which starts with an appropriate prefix 
[google-objc-global-variable-declaration]
+// CHECK-FIXES: static NSString* const kMyConstString = @"hello";
+
+class MyTest {
+static int not_objc_style;
+};


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r354485 - Update property prefix regex to allow numbers.

2019-02-20 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Wed Feb 20 09:32:41 2019
New Revision: 354485

URL: http://llvm.org/viewvc/llvm-project?rev=354485&view=rev
Log:
Update property prefix regex to allow numbers.

Subscribers: jfb, cfe-commits

Differential Revision: https://reviews.llvm.org/D56896

Modified:
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=354485&r1=354484&r2=354485&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Wed 
Feb 20 09:32:41 2019
@@ -80,7 +80,8 @@ std::string validPropertyNameRegex(bool
 }
 
 bool hasCategoryPropertyPrefix(llvm::StringRef PropertyName) {
-  auto RegexExp = llvm::Regex("^[a-zA-Z]+_[a-zA-Z0-9][a-zA-Z0-9_]+$");
+  auto RegexExp =
+  llvm::Regex("^[a-zA-Z][a-zA-Z0-9]*_[a-zA-Z0-9][a-zA-Z0-9_]+$");
   return RegexExp.match(PropertyName);
 }
 
@@ -91,8 +92,7 @@ bool prefixedPropertyNameValid(llvm::Str
   if (Prefix.lower() != Prefix) {
 return false;
   }
-  auto RegexExp =
-  llvm::Regex(llvm::StringRef(validPropertyNameRegex(false)));
+  auto RegexExp = llvm::Regex(llvm::StringRef(validPropertyNameRegex(false)));
   return RegexExp.match(PropertyName.substr(Start + 1));
 }
 }  // namespace
@@ -101,13 +101,12 @@ void PropertyDeclarationCheck::registerM
   // this check should only be applied to ObjC sources.
   if (!getLangOpts().ObjC) return;
 
-  Finder->addMatcher(
-  objcPropertyDecl(
-  // the property name should be in Lower Camel Case like
-  // 'lowerCamelCase'
-  unless(matchesName(validPropertyNameRegex(true
-  .bind("property"),
-  this);
+  Finder->addMatcher(objcPropertyDecl(
+ // the property name should be in Lower Camel Case 
like
+ // 'lowerCamelCase'
+ unless(matchesName(validPropertyNameRegex(true
+ .bind("property"),
+ this);
 }
 
 void PropertyDeclarationCheck::check(const MatchFinder::MatchResult &Result) {

Modified: clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m?rev=354485&r1=354484&r2=354485&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m Wed Feb 
20 09:32:41 2019
@@ -46,6 +46,7 @@ typedef void *CGColorRef;
 @property(strong, nonatomic) NSString *URLStr;
 @property(assign, nonatomic) int abc_camelCase;
 @property(strong, nonatomic) NSString *abc_URL;
+@property(strong, nonatomic) NSString *opac2_sourceComponent;
 @end
 
 @interface Foo ()


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r346566 - Fix ClangFormat issue of recognizing ObjC subscript as C++ attributes when message target is a result of a C-style method.

2018-11-09 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Fri Nov  9 15:19:14 2018
New Revision: 346566

URL: http://llvm.org/viewvc/llvm-project?rev=346566&view=rev
Log:
Fix ClangFormat issue of recognizing ObjC subscript as C++ attributes when 
message target is a result of a C-style method.

Summary:
The issue is that for array subscript like:

```
arr[[Foo() bar]];
```
ClangFormat will recognize it as C++11 attribute syntax and put a space between 
'arr' and first '[', like:

```
arr [[Foo() bar]];
```

Now it is fixed. Tested with:
```
ninja FormatTests
```

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D54288

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=346566&r1=346565&r2=346566&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Nov  9 15:19:14 2018
@@ -366,7 +366,8 @@ private:
   // specifier parameter, although this is technically valid:
   // [[foo(:)]]
   if (AttrTok->is(tok::colon) ||
-  AttrTok->startsSequence(tok::identifier, tok::identifier))
+  AttrTok->startsSequence(tok::identifier, tok::identifier) || 
+  AttrTok->startsSequence(tok::r_paren, tok::identifier))
 return false;
   if (AttrTok->is(tok::ellipsis))
 return true;

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=346566&r1=346565&r2=346566&view=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Nov  9 15:19:14 2018
@@ -6472,6 +6472,8 @@ TEST_F(FormatTest, UnderstandsSquareAttr
   // Make sure we do not mistake attributes for array subscripts.
   verifyFormat("int a() {}\n"
"[[unused]] int b() {}\n");
+  verifyFormat("NSArray *arr;\n"
+   "arr[[Foo() bar]];");
 
   // On the other hand, we still need to correctly find array subscripts.
   verifyFormat("int a = std::vector{1, 2, 3}[0];");


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r345858 - Fix the issue that not recognizing single acronym with prefix as ObjC property name.

2018-11-01 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Thu Nov  1 10:36:18 2018
New Revision: 345858

URL: http://llvm.org/viewvc/llvm-project?rev=345858&view=rev
Log:
Fix the issue that not recognizing single acronym with prefix as ObjC property 
name.

Summary: This will make clang-tidy accept property names like xyz_URL (URL is a 
common acronym).

Reviewers: benhamilton, hokein

Reviewed By: benhamilton

Subscribers: jfb, cfe-commits

Differential Revision: https://reviews.llvm.org/D53955

Modified:
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=345858&r1=345857&r2=345858&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Thu 
Nov  1 10:36:18 2018
@@ -201,8 +201,7 @@ PropertyDeclarationCheck::PropertyDeclar
 
 void PropertyDeclarationCheck::registerMatchers(MatchFinder *Finder) {
   // this check should only be applied to ObjC sources.
-  if (!getLangOpts().ObjC)
-return;
+  if (!getLangOpts().ObjC) return;
 
   if (IncludeDefaultAcronyms) {
 EscapedAcronyms.reserve(llvm::array_lengthof(DefaultSpecialAcronyms) +
@@ -235,9 +234,9 @@ void PropertyDeclarationCheck::check(con
   auto *DeclContext = MatchedDecl->getDeclContext();
   auto *CategoryDecl = llvm::dyn_cast(DeclContext);
 
-  auto AcronymsRegex =
-  llvm::Regex("^" + AcronymsGroupRegex(EscapedAcronyms) + "$");
-  if (AcronymsRegex.match(MatchedDecl->getName())) {
+  auto SingleAcronymRegex =
+  llvm::Regex("^([a-zA-Z]+_)?" + AcronymsGroupRegex(EscapedAcronyms) + 
"$");
+  if (SingleAcronymRegex.match(MatchedDecl->getName())) {
 return;
   }
   if (CategoryDecl != nullptr &&

Modified: clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m?rev=345858&r1=345857&r2=345858&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m Thu Nov 
 1 10:36:18 2018
@@ -38,6 +38,7 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'wrongFormat_' not 
using lowerCamelCase style or not prefixed in a category, according to the 
Apple Coding Guidelines [objc-property-declaration]
 @property(strong, nonatomic) NSString *URLStr;
 @property(assign, nonatomic) int abc_camelCase;
+@property(strong, nonatomic) NSString *abc_URL;
 @end
 
 @interface Foo ()


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r334448 - - Add "AV" as new default acronym. - Add support for "I" and "A" in lowerCamelCase pattern

2018-06-11 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Mon Jun 11 15:44:06 2018
New Revision: 334448

URL: http://llvm.org/viewvc/llvm-project?rev=334448&view=rev
Log:
- Add "AV" as new default acronym. - Add support for "I" and "A" in 
lowerCamelCase pattern

Summary: Now we can support property names like "hasADog" correctly.

Reviewers: benhamilton, hokein

Reviewed By: benhamilton

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D48039

Modified:
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=334448&r1=334447&r2=334448&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Mon 
Jun 11 15:44:06 2018
@@ -45,6 +45,7 @@ constexpr llvm::StringLiteral DefaultSpe
 "AR",
 "ARGB",
 "ASCII",
+"AV",
 "BGRA",
 "CA",
 "CF",
@@ -153,7 +154,7 @@ std::string validPropertyNameRegex(llvm:
   std::string StartMatcher = UsedInMatcher ? "::" : "^";
   std::string AcronymsMatcher = AcronymsGroupRegex(EscapedAcronyms);
   return StartMatcher + "(" + AcronymsMatcher + "[A-Z]?)?[a-z]+[a-z0-9]*(" +
- AcronymsMatcher + "|([A-Z][a-z0-9]+))*$";
+ AcronymsMatcher + "|([A-Z][a-z0-9]+)|A|I)*$";
 }
 
 bool hasCategoryPropertyPrefix(llvm::StringRef PropertyName) {

Modified: clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m?rev=334448&r1=334447&r2=334448&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m Mon Jun 
11 15:44:06 2018
@@ -22,6 +22,7 @@
 @property(assign, nonatomic) int shouldUseCFPreferences;
 @property(assign, nonatomic) int enableGLAcceleration;
 @property(assign, nonatomic) int ID;
+@property(assign, nonatomic) int hasADog;
 @end
 
 @interface Foo (Bar)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r332382 - add AR to acronyms of clang-tidy property check

2018-05-15 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Tue May 15 11:13:51 2018
New Revision: 332382

URL: http://llvm.org/viewvc/llvm-project?rev=332382&view=rev
Log:
add AR to acronyms of clang-tidy property check

Reviewers: hokein, benhamilton

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D46895

Modified:
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=332382&r1=332381&r2=332382&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Tue 
May 15 11:13:51 2018
@@ -42,6 +42,7 @@ constexpr llvm::StringLiteral DefaultSpe
 "[2-9]G",
 "ACL",
 "API",
+"AR",
 "ARGB",
 "ASCII",
 "BGRA",


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r331545 - Add support for ObjC property name to be a single acronym.

2018-05-04 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Fri May  4 11:14:08 2018
New Revision: 331545

URL: http://llvm.org/viewvc/llvm-project?rev=331545&view=rev
Log:
Add support for ObjC property name to be a single acronym.

Summary:
This change will support cases like:

```
@property(assign, nonatomic) int ID;
```

Reviewers: benhamilton, hokein

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D46374

Modified:
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=331545&r1=331544&r2=331545&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Fri 
May  4 11:14:08 2018
@@ -217,6 +217,12 @@ void PropertyDeclarationCheck::check(con
   assert(MatchedDecl->getName().size() > 0);
   auto *DeclContext = MatchedDecl->getDeclContext();
   auto *CategoryDecl = llvm::dyn_cast(DeclContext);
+
+  auto AcronymsRegex =
+  llvm::Regex("^" + AcronymsGroupRegex(EscapedAcronyms) + "$");
+  if (AcronymsRegex.match(MatchedDecl->getName())) {
+return;
+  }
   if (CategoryDecl != nullptr &&
   hasCategoryPropertyPrefix(MatchedDecl->getName())) {
 if (!prefixedPropertyNameValid(MatchedDecl->getName(), EscapedAcronyms) ||

Modified: 
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m?rev=331545&r1=331544&r2=331545&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m 
Fri May  4 11:14:08 2018
@@ -14,4 +14,5 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:40: warning: property name 'ABC_custom_prefix' 
not using lowerCamelCase style or not prefixed in a category, according to the 
Apple Coding Guidelines [objc-property-declaration]
 @property(assign, nonatomic) int GIFIgnoreStandardAcronym;
 // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 
'GIFIgnoreStandardAcronym' not using lowerCamelCase style or not prefixed in a 
category, according to the Apple Coding Guidelines [objc-property-declaration]
+@property(strong, nonatomic) NSString *TGIF;
 @end

Modified: clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m?rev=331545&r1=331544&r2=331545&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m Fri May 
 4 11:14:08 2018
@@ -21,6 +21,7 @@
 @property(assign, nonatomic) int enable2GBackgroundFetch;
 @property(assign, nonatomic) int shouldUseCFPreferences;
 @property(assign, nonatomic) int enableGLAcceleration;
+@property(assign, nonatomic) int ID;
 @end
 
 @interface Foo (Bar)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r330559 - update test to use ivar in implementation instead of class extension

2018-04-22 Thread Yan Zhang via cfe-commits
Did not see any failure related to https://reviews.llvm.org/D45936 yet after 
submission.

Best regards
Yan Zhang

> On Apr 22, 2018, at 18:13, Chandler Carruth  wrote:
> 
> I won't be back at a computer for a while and I really don't know anything 
> about objective-c... But if you don't feel confident submitting fixes with 
> post commit review, you should probably just revert If the fix is trivial 
> and/or you can find ways to test it a similar suggested in my earlier email, 
> then I'd suggest landing it and watching the build bots to ensure they are 
> happy. But if you can't figure out how to restore the bots you'll end up 
> needing to revert the whole series and get some help from someone with access 
> to another platform.
> 
>> On Sun, Apr 22, 2018, 18:03 Yan Zhang via cfe-commits 
>>  wrote:
>> Need a accept for that revision. Can you accept it?
>> 
>>> On Sun, Apr 22, 2018 at 6:02 PM Chandler Carruth  
>>> wrote:
>>> See my other email -- you can compile code targeting other platforms 
>>> regardless of the platform you develop on. Not exactly as good as 
>>> reproducing it with a bot, but about the best you have.
>>> 
>>>> On Sun, Apr 22, 2018 at 6:01 PM Chandler Carruth  
>>>> wrote:
>>>> I don't know anything about objective-c, or anything about OSX.
>>>> 
>>>> However, I guarantee these bots aren't using 32-bit OSX. ;] Look at the 
>>>> bot names. They're running Linux in various flavors: ppc64be, ppc64le, 
>>>> armv8, etc.
>>>> 
>>>> My suspicion is that this is a linux-specific issue.
>>>> 
>>>> But you can reproduce this yourself. Just run clang (or clang-tidy) over 
>>>> this test file with --target= for various linux triples. It 
>>>> doesn't include any headers or anything else, so you should be able to see 
>>>> all these failures.
>>>> 
>>>> Anyways, please land that revision or revert until you have a reviewer for 
>>>> it (many maybe not around this weekend). But please don't leave the bots 
>>>> broken.
>>>> 
>>>>> On Sun, Apr 22, 2018 at 5:55 PM Yan Zhang  wrote:
>>>> 
>>>>> I am running tests locally with "ninja check-clang-tools" and I am sure 
>>>>> it is running this test because I could get error message when I debug it.
>>>>> 
>>>>> The problem (according to the error message) is all caused by different 
>>>>> architecture. It seems a lot of ObjC features are not supported in old 
>>>>> 32-bit OSX (which I believe the test bots are using). I have another 
>>>>> revision sent out to see if it can help. Can you take a quick look? 
>>>>> https://reviews.llvm.org/D45936
>>>>> 
>>>>>> On Sun, Apr 22, 2018 at 5:51 PM Chandler Carruth  
>>>>>> wrote:
>>>>>> The commit log here no longer reflects the commit. This is not just 
>>>>>> updating the test, this is a complete re-application of the original 
>>>>>> patch in r330492. =[
>>>>>> 
>>>>>> Also, the bots are still complaining:
>>>>>> http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/17830
>>>>>> http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/1979
>>>>>> http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/11659
>>>>>> 
>>>>>> I'm not sure how you're running your tests that you don't see these 
>>>>>> issues, but they seem to reproduce on many build bots and the error 
>>>>>> message doesn't seem to be architecture specific at all...
>>>>>> 
>>>>>> I suspect something about how you are trying to run tests isn't actually 
>>>>>> running this test if you aren't able to locally reproduce.
>>>>>> 
>>>>>>> On Sun, Apr 22, 2018 at 5:19 PM Yan Zhang via cfe-commits 
>>>>>>>  wrote:
>>>>>>> Author: wizard
>>>>>>> Date: Sun Apr 22 17:15:15 2018
>>>>>>> New Revision: 330559
>>>>>>> 
>>>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=330559&view=rev
>>>>>>> Log:
>>>>>>> update test to use ivar in implementation instead of class extension
>>>>>>> 
>>>>&

Re: [clang-tools-extra] r330559 - update test to use ivar in implementation instead of class extension

2018-04-22 Thread Yan Zhang via cfe-commits
Sure. Will do. The change I am trying is pretty trivial and only limited to
the test itself.

On Sun, Apr 22, 2018 at 6:13 PM Chandler Carruth 
wrote:

> I won't be back at a computer for a while and I really don't know anything
> about objective-c... But if you don't feel confident submitting fixes with
> post commit review, you should probably just revert If the fix is
> trivial and/or you can find ways to test it a similar suggested in my
> earlier email, then I'd suggest landing it and watching the build bots to
> ensure they are happy. But if you can't figure out how to restore the bots
> you'll end up needing to revert the whole series and get some help from
> someone with access to another platform.
>
> On Sun, Apr 22, 2018, 18:03 Yan Zhang via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Need a accept for that revision. Can you accept it?
>>
>> On Sun, Apr 22, 2018 at 6:02 PM Chandler Carruth 
>> wrote:
>>
>>> See my other email -- you can compile code targeting other platforms
>>> regardless of the platform you develop on. Not exactly as good as
>>> reproducing it with a bot, but about the best you have.
>>>
>>> On Sun, Apr 22, 2018 at 6:01 PM Chandler Carruth 
>>> wrote:
>>>
>>>> I don't know anything about objective-c, or anything about OSX.
>>>>
>>>> However, I guarantee these bots aren't using 32-bit OSX. ;] Look at the
>>>> bot names. They're running Linux in various flavors: ppc64be, ppc64le,
>>>> armv8, etc.
>>>>
>>>> My suspicion is that this is a linux-specific issue.
>>>>
>>>> But you can reproduce this yourself. Just run clang (or clang-tidy)
>>>> over this test file with --target= for various linux triples. It
>>>> doesn't include any headers or anything else, so you should be able to see
>>>> all these failures.
>>>>
>>>> Anyways, please land that revision or revert until you have a reviewer
>>>> for it (many maybe not around this weekend). But please don't leave the
>>>> bots broken.
>>>>
>>>> On Sun, Apr 22, 2018 at 5:55 PM Yan Zhang  wrote:
>>>>
>>>>> I am running tests locally with "ninja check-clang-tools" and I am
>>>>> sure it is running this test because I could get error message when I 
>>>>> debug
>>>>> it.
>>>>>
>>>>> The problem (according to the error message) is all caused by
>>>>> different architecture. It seems a lot of ObjC features are not supported
>>>>> in old 32-bit OSX (which I believe the test bots are using). I have 
>>>>> another
>>>>> revision sent out to see if it can help. Can you take a quick look?
>>>>> https://reviews.llvm.org/D45936
>>>>>
>>>>> On Sun, Apr 22, 2018 at 5:51 PM Chandler Carruth 
>>>>> wrote:
>>>>>
>>>>>> The commit log here no longer reflects the commit. This is not just
>>>>>> updating the test, this is a complete re-application of the original 
>>>>>> patch
>>>>>> in r330492. =[
>>>>>>
>>>>>> Also, the bots are still complaining:
>>>>>> http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/17830
>>>>>> http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/1979
>>>>>> http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/11659
>>>>>>
>>>>>> I'm not sure how you're running your tests that you don't see these
>>>>>> issues, but they seem to reproduce on many build bots and the error 
>>>>>> message
>>>>>> doesn't seem to be architecture specific at all...
>>>>>>
>>>>>> I suspect something about how you are trying to run tests isn't
>>>>>> actually running this test if you aren't able to locally reproduce.
>>>>>>
>>>>>> On Sun, Apr 22, 2018 at 5:19 PM Yan Zhang via cfe-commits <
>>>>>> cfe-commits@lists.llvm.org> wrote:
>>>>>>
>>>>>>> Author: wizard
>>>>>>> Date: Sun Apr 22 17:15:15 2018
>>>>>>> New Revision: 330559
>>>>>>>
>>>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=330559&view=rev
>>>>>>> Log:
>>>>

[clang-tools-extra] r330562 - update readability-identifier-naming-objc test to use interface ivar. Implementation ivars are not supported in 32-bits OS.

2018-04-22 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Sun Apr 22 18:05:02 2018
New Revision: 330562

URL: http://llvm.org/viewvc/llvm-project?rev=330562&view=rev
Log:
update readability-identifier-naming-objc test to use interface ivar. 
Implementation ivars are not supported in 32-bits OS.

Reviewers: alexfh, chandlerc

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D45936

Modified:
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m

Modified: 
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=330562&r1=330561&r2=330562&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m 
(original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming-objc.m 
Sun Apr 22 18:05:02 2018
@@ -3,13 +3,10 @@
 // RUN:  [{key: readability-identifier-naming.ObjcIvarPrefix, value: '_'}]}' \
 // RUN: --
 
-@interface Foo
-@end 
-
-@implementation Foo {
+@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;
 }
-@end
+@end 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r330559 - update test to use ivar in implementation instead of class extension

2018-04-22 Thread Yan Zhang via cfe-commits
Need a accept for that revision. Can you accept it?

On Sun, Apr 22, 2018 at 6:02 PM Chandler Carruth 
wrote:

> See my other email -- you can compile code targeting other platforms
> regardless of the platform you develop on. Not exactly as good as
> reproducing it with a bot, but about the best you have.
>
> On Sun, Apr 22, 2018 at 6:01 PM Chandler Carruth 
> wrote:
>
>> I don't know anything about objective-c, or anything about OSX.
>>
>> However, I guarantee these bots aren't using 32-bit OSX. ;] Look at the
>> bot names. They're running Linux in various flavors: ppc64be, ppc64le,
>> armv8, etc.
>>
>> My suspicion is that this is a linux-specific issue.
>>
>> But you can reproduce this yourself. Just run clang (or clang-tidy) over
>> this test file with --target= for various linux triples. It doesn't
>> include any headers or anything else, so you should be able to see all
>> these failures.
>>
>> Anyways, please land that revision or revert until you have a reviewer
>> for it (many maybe not around this weekend). But please don't leave the
>> bots broken.
>>
>> On Sun, Apr 22, 2018 at 5:55 PM Yan Zhang  wrote:
>>
>>> I am running tests locally with "ninja check-clang-tools" and I am sure
>>> it is running this test because I could get error message when I debug it.
>>>
>>> The problem (according to the error message) is all caused by different
>>> architecture. It seems a lot of ObjC features are not supported in old
>>> 32-bit OSX (which I believe the test bots are using). I have another
>>> revision sent out to see if it can help. Can you take a quick look?
>>> https://reviews.llvm.org/D45936
>>>
>>> On Sun, Apr 22, 2018 at 5:51 PM Chandler Carruth 
>>> wrote:
>>>
>>>> The commit log here no longer reflects the commit. This is not just
>>>> updating the test, this is a complete re-application of the original patch
>>>> in r330492. =[
>>>>
>>>> Also, the bots are still complaining:
>>>> http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/17830
>>>> http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/1979
>>>> http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/11659
>>>>
>>>> I'm not sure how you're running your tests that you don't see these
>>>> issues, but they seem to reproduce on many build bots and the error message
>>>> doesn't seem to be architecture specific at all...
>>>>
>>>> I suspect something about how you are trying to run tests isn't
>>>> actually running this test if you aren't able to locally reproduce.
>>>>
>>>> On Sun, Apr 22, 2018 at 5:19 PM Yan Zhang via cfe-commits <
>>>> cfe-commits@lists.llvm.org> wrote:
>>>>
>>>>> Author: wizard
>>>>> Date: Sun Apr 22 17:15:15 2018
>>>>> New Revision: 330559
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=330559&view=rev
>>>>> Log:
>>>>> update test to use ivar in implementation instead of class extension
>>>>>
>>>>> Summary: using ivar in class extension is not supported in 32-bit
>>>>> architecture of MacOS.
>>>>>
>>>>> Reviewers: alexfh, hokein
>>>>>
>>>>> Reviewed By: alexfh
>>>>>
>>>>> Subscribers: klimek, cfe-commits
>>>>>
>>>>> Differential Revision: https://reviews.llvm.org/D45912
>>>>>
>>>>> 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=330559&r1=330558&r2=330559&view=diff
>>>>>
>>>>> ==
>>>>> ---
>>>>> clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
>>>>> (original)
>>>>> +++
>>>>> clang-tools-extra/trunk/clang-tidy/readab

Re: [clang-tools-extra] r330559 - update test to use ivar in implementation instead of class extension

2018-04-22 Thread Yan Zhang via cfe-commits
btw due to the lack of way to testing it on bot environments, I am not sure
if specify fobjc-abo-version=2 could solve the problem (could it break
builds on 32-bit machines or just skip them). So I played safe to use the
old way of declaring ivars in the revision.

On Sun, Apr 22, 2018 at 5:55 PM Yan Zhang  wrote:

> I am running tests locally with "ninja check-clang-tools" and I am sure
> it is running this test because I could get error message when I debug it.
>
> The problem (according to the error message) is all caused by different
> architecture. It seems a lot of ObjC features are not supported in old
> 32-bit OSX (which I believe the test bots are using). I have another
> revision sent out to see if it can help. Can you take a quick look?
> https://reviews.llvm.org/D45936
>
> On Sun, Apr 22, 2018 at 5:51 PM Chandler Carruth 
> wrote:
>
>> The commit log here no longer reflects the commit. This is not just
>> updating the test, this is a complete re-application of the original patch
>> in r330492. =[
>>
>> Also, the bots are still complaining:
>> http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/17830
>> http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/1979
>> http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/11659
>>
>> I'm not sure how you're running your tests that you don't see these
>> issues, but they seem to reproduce on many build bots and the error message
>> doesn't seem to be architecture specific at all...
>>
>> I suspect something about how you are trying to run tests isn't actually
>> running this test if you aren't able to locally reproduce.
>>
>> On Sun, Apr 22, 2018 at 5:19 PM Yan Zhang via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: wizard
>>> Date: Sun Apr 22 17:15:15 2018
>>> New Revision: 330559
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=330559&view=rev
>>> Log:
>>> update test to use ivar in implementation instead of class extension
>>>
>>> Summary: using ivar in class extension is not supported in 32-bit
>>> architecture of MacOS.
>>>
>>> Reviewers: alexfh, hokein
>>>
>>> Reviewed By: alexfh
>>>
>>> Subscribers: klimek, cfe-commits
>>>
>>> Differential Revision: https://reviews.llvm.org/D45912
>>>
>>> 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=330559&r1=330558&r2=330559&view=diff
>>>
>>> ==
>>> ---
>>> clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
>>> (original)
>>> +++
>>> clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
>>> Sun Apr 22 17:15:15 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>
>>>  &NamingStyles) {
>>> +  if (isa(D) && NamingStyles[SK_ObjcIvar])
>>> +return SK_ObjcIvar;
>>> +
>>>if (isa(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=330559&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
>>> Sun Apr 22 17:15:15 2018
>>> @@ -0,0 +1,15 @@
>>> +// R

Re: [clang-tools-extra] r330559 - update test to use ivar in implementation instead of class extension

2018-04-22 Thread Yan Zhang via cfe-commits
I am running tests locally with "ninja check-clang-tools" and I am sure it
is running this test because I could get error message when I debug it.

The problem (according to the error message) is all caused by different
architecture. It seems a lot of ObjC features are not supported in old
32-bit OSX (which I believe the test bots are using). I have another
revision sent out to see if it can help. Can you take a quick look?
https://reviews.llvm.org/D45936

On Sun, Apr 22, 2018 at 5:51 PM Chandler Carruth 
wrote:

> The commit log here no longer reflects the commit. This is not just
> updating the test, this is a complete re-application of the original patch
> in r330492. =[
>
> Also, the bots are still complaining:
> http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/17830
> http://lab.llvm.org:8011/builders/clang-cmake-armv8-quick/builds/1979
> http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/11659
>
> I'm not sure how you're running your tests that you don't see these
> issues, but they seem to reproduce on many build bots and the error message
> doesn't seem to be architecture specific at all...
>
> I suspect something about how you are trying to run tests isn't actually
> running this test if you aren't able to locally reproduce.
>
> On Sun, Apr 22, 2018 at 5:19 PM Yan Zhang via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: wizard
>> Date: Sun Apr 22 17:15:15 2018
>> New Revision: 330559
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=330559&view=rev
>> Log:
>> update test to use ivar in implementation instead of class extension
>>
>> Summary: using ivar in class extension is not supported in 32-bit
>> architecture of MacOS.
>>
>> Reviewers: alexfh, hokein
>>
>> Reviewed By: alexfh
>>
>> Subscribers: klimek, cfe-commits
>>
>> Differential Revision: https://reviews.llvm.org/D45912
>>
>> 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=330559&r1=330558&r2=330559&view=diff
>>
>> ==
>> ---
>> clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
>> (original)
>> +++
>> clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
>> Sun Apr 22 17:15:15 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>
>>  &NamingStyles) {
>> +  if (isa(D) && NamingStyles[SK_ObjcIvar])
>> +return SK_ObjcIvar;
>> +
>>if (isa(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=330559&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
>> Sun Apr 22 17:15:15 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: --
>> +
>> +@interface Foo
>> +@end
>> +
>> +@implementation 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;
>> +}
>> +@end
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>

-- 
Best regards
Yan Zhang
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r330559 - update test to use ivar in implementation instead of class extension

2018-04-22 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Sun Apr 22 17:15:15 2018
New Revision: 330559

URL: http://llvm.org/viewvc/llvm-project?rev=330559&view=rev
Log:
update test to use ivar in implementation instead of class extension

Summary: using ivar in class extension is not supported in 32-bit architecture 
of MacOS.

Reviewers: alexfh, hokein

Reviewed By: alexfh

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D45912

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=330559&r1=330558&r2=330559&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
Sun Apr 22 17:15:15 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>
 &NamingStyles) {
+  if (isa(D) && NamingStyles[SK_ObjcIvar])
+return SK_ObjcIvar;
+  
   if (isa(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=330559&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 
Sun Apr 22 17:15:15 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: --
+
+@interface Foo
+@end 
+
+@implementation 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;
+}
+@end


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2018-04-22 Thread Yan Zhang via cfe-commits
Btw is there any way to test on bots before submission? Ninja tests already 
works on my local machine 

Best regards
Yan Zhang

> On Apr 21, 2018, at 18:15, Chandler Carruth  wrote:
> 
> Should be able to reproduce it by patching it in and running the tests 
> yourself? Nothing configuration specific here. Still, no hurry.
> 
>> On Sat, Apr 21, 2018 at 6:02 PM Yan Zhang via cfe-commits 
>>  wrote:
>> Sorry I was out today. What is the new error? Can u send it to me?
>> 
>> Best regards
>> Yan Zhang
>> 
>>> On Apr 21, 2018, at 16:32, Chandler Carruth  wrote:
>>> 
>>> 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  
>>>> 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 
>>>>>  wrote:
>>>>> https://reviews.llvm.org/D45912 need someone to accept 
>>>>> 
>>>>> Best regards
>>>>> Yan Zhang
>>>>> 
>>>>>> On Apr 20, 2018, at 19:08, Chandler Carruth  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 
>>>>>>>  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 @@ nam

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

2018-04-21 Thread Yan Zhang via cfe-commits
Hmm I have tested it locally before with 64-bit macOS and everything looks good.

Best regards
Yan Zhang

> On Apr 21, 2018, at 18:15, Chandler Carruth  wrote:
> 
> Should be able to reproduce it by patching it in and running the tests 
> yourself? Nothing configuration specific here. Still, no hurry.
> 
>> On Sat, Apr 21, 2018 at 6:02 PM Yan Zhang via cfe-commits 
>>  wrote:
>> Sorry I was out today. What is the new error? Can u send it to me?
>> 
>> Best regards
>> Yan Zhang
>> 
>>> On Apr 21, 2018, at 16:32, Chandler Carruth  wrote:
>>> 
>>> 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  
>>>> 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 
>>>>>  wrote:
>>>>> https://reviews.llvm.org/D45912 need someone to accept 
>>>>> 
>>>>> Best regards
>>>>> Yan Zhang
>>>>> 
>>>>>> On Apr 20, 2018, at 19:08, Chandler Carruth  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 
>>>>>>>  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

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

2018-04-21 Thread Yan Zhang via cfe-commits
Sorry I was out today. What is the new error? Can u send it to me?

Best regards
Yan Zhang

> On Apr 21, 2018, at 16:32, Chandler Carruth  wrote:
> 
> 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  
>> 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 
>>>  wrote:
>>> https://reviews.llvm.org/D45912 need someone to accept 
>>> 
>>> Best regards
>>> Yan Zhang
>>> 
>>>> On Apr 20, 2018, at 19:08, Chandler Carruth  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 
>>>>>  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>
>>>>>  &NamingStyles) {
>>>>> +  if (isa(D) && NamingStyles[SK_ObjcIvar])
>>>>> +return SK_ObjcIvar;
>>>>> +
>>>>>if (isa(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&a

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

2018-04-20 Thread Yan Zhang via cfe-commits
https://reviews.llvm.org/D45912 need someone to accept 

Best regards
Yan Zhang

> On Apr 20, 2018, at 19:08, Chandler Carruth  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 
>>  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>
>>  &NamingStyles) {
>> +  if (isa(D) && NamingStyles[SK_ObjcIvar])
>> +return SK_ObjcIvar;
>> +
>>if (isa(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: --
>> +
>> +@interface Foo
>> +@end 
>> +
>> +@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;
>> +}
>> +@end
>> 
>> 
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2018-04-20 Thread Yan Zhang via cfe-commits
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>
 &NamingStyles) {
+  if (isa(D) && NamingStyles[SK_ObjcIvar])
+return SK_ObjcIvar;
+
   if (isa(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: --
+
+@interface Foo
+@end 
+
+@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;
+}
+@end


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r330286 - add extra acronyms for objc property names

2018-04-18 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Wed Apr 18 13:09:10 2018
New Revision: 330286

URL: http://llvm.org/viewvc/llvm-project?rev=330286&view=rev
Log:
add extra acronyms for objc property names

Summary: This is to support general acronyms in Objective-C like 2G/3G/4G/... 
and coordinates X, Y, Z and W.

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D45750

Modified:
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=330286&r1=330285&r2=330286&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Wed 
Apr 18 13:09:10 2018
@@ -39,6 +39,7 @@ enum NamingStyle {
 ///
 /// Keep this list sorted.
 constexpr llvm::StringLiteral DefaultSpecialAcronyms[] = {
+"[2-9]G",
 "ACL",
 "API",
 "ARGB",
@@ -93,8 +94,12 @@ constexpr llvm::StringLiteral DefaultSpe
 "VOIP",
 "VPN",
 "VR",
+"W",
 "WAN",
+"X",
 "XML",
+"Y",
+"Z",
 };
 
 /// For now we will only fix 'CamelCase' or 'abc_CamelCase' property to

Modified: clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m?rev=330286&r1=330285&r2=330286&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m Wed Apr 
18 13:09:10 2018
@@ -17,6 +17,8 @@
 @property(strong, nonatomic) NSString *supportURLsCamelCase;
 @property(strong, nonatomic) NSString *supportURLCamelCase;
 @property(strong, nonatomic) NSString *VCsPluralToAdd;
+@property(assign, nonatomic) int centerX;
+@property(assign, nonatomic) int enable2GBackgroundFetch;
 @end
 
 @interface Foo (Bar)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r326928 - do not register matcher for objc-only checks when analyzing non-objc sources to save resources

2018-03-07 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Wed Mar  7 10:59:25 2018
New Revision: 326928

URL: http://llvm.org/viewvc/llvm-project?rev=326928&view=rev
Log:
do not register matcher for objc-only checks when analyzing non-objc sources to 
save resources

Summary: I did not put lang opt check in AvoidSpinlockCheck since OSSpinLock is 
not objc specific. We won't want to skip it when analyzing some C++ target used 
by other ObjC sources.

Reviewers: hokein, benhamilton

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D44174

Modified:

clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp
clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp?rev=326928&r1=326927&r2=326928&view=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp 
(original)
+++ 
clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp 
Wed Mar  7 10:59:25 2018
@@ -19,6 +19,11 @@ namespace google {
 namespace objc {
 
 void AvoidThrowingObjCExceptionCheck::registerMatchers(MatchFinder *Finder) {
+  // this check should only be applied to ObjC sources.
+  if (!getLangOpts().ObjC1 && !getLangOpts().ObjC2) {
+return;
+  }
+
   Finder->addMatcher(objcThrowStmt().bind("throwStmt"), this);
   Finder->addMatcher(
   objcMessageExpr(anyOf(hasSelector("raise:format:"),

Modified: clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp?rev=326928&r1=326927&r2=326928&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp Wed Mar  
7 10:59:25 2018
@@ -18,6 +18,10 @@ namespace tidy {
 namespace objc {
 
 void AvoidNSErrorInitCheck::registerMatchers(MatchFinder *Finder) {
+  // this check should only be applied to ObjC sources.
+  if (!getLangOpts().ObjC1 && !getLangOpts().ObjC2) {
+return;
+  }
   Finder->addMatcher(objcMessageExpr(hasSelector("init"),
  hasReceiverType(asString("NSError *")))
  .bind("nserrorInit"),

Modified: clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp?rev=326928&r1=326927&r2=326928&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp Wed 
Mar  7 10:59:25 2018
@@ -77,6 +77,10 @@ ForbiddenSubclassingCheck::ForbiddenSubc
 }
 
 void ForbiddenSubclassingCheck::registerMatchers(MatchFinder *Finder) {
+  // this check should only be applied to ObjC sources.
+  if (!getLangOpts().ObjC1 && !getLangOpts().ObjC2) {
+return;
+  }
   Finder->addMatcher(
   objcInterfaceDecl(
   isSubclassOf(

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=326928&r1=326927&r2=326928&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Wed 
Mar  7 10:59:25 2018
@@ -170,6 +170,10 @@ PropertyDeclarationCheck::PropertyDeclar
   EscapedAcronyms() {}
 
 void PropertyDeclarationCheck::registerMatchers(MatchFinder *Finder) {
+  // this check should only be applied to ObjC sources.
+  if (!getLangOpts().ObjC1 && !getLangOpts().ObjC2) {
+return;
+  }
   if (IncludeDefaultAcronyms) {
 EscapedAcronyms.reserve(llvm::array_lengthof(DefaultSpecialAcronyms) +
 SpecialAcronyms.size());


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r326222 - add UUID to the acronyms list of objc property name checks

2018-02-27 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Tue Feb 27 10:35:53 2018
New Revision: 326222

URL: http://llvm.org/viewvc/llvm-project?rev=326222&view=rev
Log:
add UUID to the acronyms list of objc property name checks

Reviewers: benhamilton, hokein

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D43775

Modified:
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=326222&r1=326221&r2=326222&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Tue 
Feb 27 10:35:53 2018
@@ -50,6 +50,7 @@ constexpr llvm::StringLiteral DefaultSpe
 "FTP",
 "GIF",
 "GPS",
+"GUID",
 "HD",
 "HDR",
 "HTML",
@@ -87,6 +88,7 @@ constexpr llvm::StringLiteral DefaultSpe
 "UI",
 "URI",
 "URL",
+"UUID",
 "VC",
 "VOIP",
 "VPN",


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r324407 - Support special acronyms inside property names and allow plural forms

2018-02-07 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Tue Feb  6 13:40:38 2018
New Revision: 324407

URL: http://llvm.org/viewvc/llvm-project?rev=324407&view=rev
Log:
Support special acronyms inside property names and allow plural forms

Reviewers: benhamilton, hokein

Reviewed By: benhamilton, hokein

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D42947

Modified:
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=324407&r1=324406&r2=324407&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Tue 
Feb  6 13:40:38 2018
@@ -12,8 +12,8 @@
 #include "../utils/OptionsUtils.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
-#include "llvm/ADT/STLExtras.h"
 #include "clang/Basic/CharInfo.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Regex.h"
 
@@ -118,6 +118,12 @@ FixItHint generateFixItHint(const ObjCPr
   return FixItHint();
 }
 
+std::string AcronymsGroupRegex(llvm::ArrayRef EscapedAcronyms) {
+  return "(" +
+ llvm::join(EscapedAcronyms.begin(), EscapedAcronyms.end(), "s?|") +
+ "s?)";
+}
+
 std::string validPropertyNameRegex(llvm::ArrayRef EscapedAcronyms,
bool UsedInMatcher) {
   // Allow any of these names:
@@ -129,12 +135,9 @@ std::string validPropertyNameRegex(llvm:
   // URLString
   // bundleID
   std::string StartMatcher = UsedInMatcher ? "::" : "^";
-
-  return StartMatcher + "((" +
- llvm::join(EscapedAcronyms.begin(), EscapedAcronyms.end(), "|") +
- ")[A-Z]?)?[a-z]+[a-z0-9]*([A-Z][a-z0-9]+)*" + "(" +
- llvm::join(EscapedAcronyms.begin(), EscapedAcronyms.end(), "|") +
- ")?$";
+  std::string AcronymsMatcher = AcronymsGroupRegex(EscapedAcronyms);
+  return StartMatcher + "(" + AcronymsMatcher + "[A-Z]?)?[a-z]+[a-z0-9]*(" +
+ AcronymsMatcher + "|([A-Z][a-z0-9]+))*$";
 }
 
 bool hasCategoryPropertyPrefix(llvm::StringRef PropertyName) {

Modified: clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m?rev=324407&r1=324406&r2=324407&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m Tue Feb 
 6 13:40:38 2018
@@ -14,6 +14,9 @@
 @property(strong, nonatomic) UIViewController *notificationsVC;
 @property(strong, nonatomic) NSString *URL_string;
 // CHECK-MESSAGES: :[[@LINE-1]]:40: warning: property name 'URL_string' not 
using lowerCamelCase style or not prefixed in a category, according to the 
Apple Coding Guidelines [objc-property-declaration]
+@property(strong, nonatomic) NSString *supportURLsCamelCase;
+@property(strong, nonatomic) NSString *supportURLCamelCase;
+@property(strong, nonatomic) NSString *VCsPluralToAdd;
 @end
 
 @interface Foo (Bar)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r323722 - add prefix with '_' support for property name. Corresponding apple dev doc: https://developer.apple.com/library/content/qa/qa1908/_index.html

2018-01-30 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Mon Jan 29 17:44:00 2018
New Revision: 323722

URL: http://llvm.org/viewvc/llvm-project?rev=323722&view=rev
Log:
add prefix with '_' support for property name. Corresponding apple dev doc: 
https://developer.apple.com/library/content/qa/qa1908/_index.html

Reviewers: benhamilton, hokein

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D42464

Modified:
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.h
clang-tools-extra/trunk/docs/clang-tidy/checks/objc-property-declaration.rst

clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-additional.m
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration-custom.m
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=323722&r1=323721&r2=323722&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Mon 
Jan 29 17:44:00 2018
@@ -8,13 +8,14 @@
 
//===--===//
 
 #include "PropertyDeclarationCheck.h"
+#include 
 #include "../utils/OptionsUtils.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "llvm/ADT/STLExtras.h"
+#include "clang/Basic/CharInfo.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/Regex.h"
-#include 
 
 using namespace clang::ast_matchers;
 
@@ -23,6 +24,16 @@ namespace tidy {
 namespace objc {
 
 namespace {
+
+// For StandardProperty the naming style is 'lowerCamelCase'.
+// For CategoryProperty especially in categories of system class,
+// to avoid naming conflict, the suggested naming style is
+// 'abc_lowerCamelCase' (adding lowercase prefix followed by '_').
+enum NamingStyle {
+  StandardProperty = 1,
+  CategoryProperty = 2,
+};
+
 /// The acronyms are from
 /// 
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE
 ///
@@ -84,22 +95,31 @@ constexpr llvm::StringLiteral DefaultSpe
 "XML",
 };
 
-/// For now we will only fix 'CamelCase' property to
-/// 'camelCase'. For other cases the users need to
+/// For now we will only fix 'CamelCase' or 'abc_CamelCase' property to
+/// 'camelCase' or 'abc_camelCase'. For other cases the users need to
 /// come up with a proper name by their own.
 /// FIXME: provide fix for snake_case to snakeCase
-FixItHint generateFixItHint(const ObjCPropertyDecl *Decl) {
-  if (isupper(Decl->getName()[0])) {
-auto NewName = Decl->getName().str();
-NewName[0] = tolower(NewName[0]);
-return FixItHint::CreateReplacement(
-CharSourceRange::getTokenRange(SourceRange(Decl->getLocation())),
-llvm::StringRef(NewName));
+FixItHint generateFixItHint(const ObjCPropertyDecl *Decl, NamingStyle Style) {
+  auto Name = Decl->getName();
+  auto NewName = Decl->getName().str();
+  size_t Index = 0;
+  if (Style == CategoryProperty) {
+Index = Name.find_first_of('_') + 1;
+NewName.replace(0, Index - 1, Name.substr(0, Index - 1).lower());
+  }
+  if (Index < Name.size()) {
+NewName[Index] = tolower(NewName[Index]);
+if (NewName != Name) {
+  return FixItHint::CreateReplacement(
+  CharSourceRange::getTokenRange(SourceRange(Decl->getLocation())),
+  llvm::StringRef(NewName));
+}
   }
   return FixItHint();
 }
 
-std::string validPropertyNameRegex(const std::vector 
&EscapedAcronyms) {
+std::string validPropertyNameRegex(llvm::ArrayRef EscapedAcronyms,
+   bool UsedInMatcher) {
   // Allow any of these names:
   // foo
   // fooBar
@@ -108,10 +128,31 @@ std::string validPropertyNameRegex(const
   // URL
   // URLString
   // bundleID
-  return std::string("::((") +
-  llvm::join(EscapedAcronyms.begin(), EscapedAcronyms.end(), "|") +
-  ")[A-Z]?)?[a-z]+[a-z0-9]*([A-Z][a-z0-9]+)*" + "(" +
-  llvm::join(EscapedAcronyms.begin(), EscapedAcronyms.end(), "|") + ")?$";
+  std::string StartMatcher = UsedInMatcher ? "::" : "^";
+
+  return StartMatcher + "((" +
+ llvm::join(EscapedAcronyms.begin(), EscapedAcronyms.end(), "|") +
+ ")[A-Z]?)?[a-z]+[a-z0-9]*([A-Z][a-z0-9]+)*" + "(" +
+ llvm::join(EscapedAcronyms.begin(), EscapedAcronyms.end(), "|") +
+ ")?$";
+}
+
+bool hasCategoryPropertyPrefix(llvm::StringRef PropertyName) {
+  auto RegexExp = llvm::Regex("^[a-zA-Z]+_[a-zA-Z0-9][a-zA-Z0-9_]+$");
+  return RegexExp.match(PropertyName);
+}
+
+bool prefixedPropertyNameValid(llvm:

[clang-tools-extra] r322602 - add ID as a special acronym to objc property declaration check for property names like bundleID.allow using acronyms as suffix.

2018-01-17 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Tue Jan 16 16:19:35 2018
New Revision: 322602

URL: http://llvm.org/viewvc/llvm-project?rev=322602&view=rev
Log:
add ID as a special acronym to objc property declaration check for property 
names like bundleID.allow using acronyms as suffix.

Reviewers: benhamilton, hokein

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D42143

Modified:
clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m

Modified: clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp?rev=322602&r1=322601&r2=322602&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/objc/PropertyDeclarationCheck.cpp Tue 
Jan 16 16:19:35 2018
@@ -41,7 +41,8 @@ constexpr char DefaultSpecialAcronyms[]
 "RGB;"
 "CMYK;"
 "MIDI;"
-"FTP";
+"FTP;"
+"ID";
 
 /// For now we will only fix 'CamelCase' property to
 /// 'camelCase'. For other cases the users need to
@@ -58,13 +59,13 @@ FixItHint generateFixItHint(const ObjCPr
   return FixItHint();
 }
 
-std::string validPropertyNameRegex(const std::vector &Prefixes) {
-  std::vector EscapedPrefixes;
-  EscapedPrefixes.reserve(Prefixes.size());
+std::string validPropertyNameRegex(const std::vector &Acronyms) {
+  std::vector EscapedAcronyms;
+  EscapedAcronyms.reserve(Acronyms.size());
   // In case someone defines a custom prefix which includes a regex
   // special character, escape all the prefixes.
-  std::transform(Prefixes.begin(), Prefixes.end(),
- std::back_inserter(EscapedPrefixes), [](const std::string& s) 
{
+  std::transform(Acronyms.begin(), Acronyms.end(),
+ std::back_inserter(EscapedAcronyms), [](const std::string& s) 
{
return llvm::Regex::escape(s); });
   // Allow any of these names:
   // foo
@@ -73,9 +74,11 @@ std::string validPropertyNameRegex(const
   // urlString
   // URL
   // URLString
+  // bundleID
   return std::string("::((") +
-  llvm::join(EscapedPrefixes.begin(), EscapedPrefixes.end(), "|") +
-  ")[A-Z]?)?[a-z]+[a-z0-9]*([A-Z][a-z0-9]+)*$";
+  llvm::join(EscapedAcronyms.begin(), EscapedAcronyms.end(), "|") +
+  ")[A-Z]?)?[a-z]+[a-z0-9]*([A-Z][a-z0-9]+)*" + "(" +
+  llvm::join(EscapedAcronyms.begin(), EscapedAcronyms.end(), "|") + ")?$";
 }
 }  // namespace
 

Modified: clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m?rev=322602&r1=322601&r2=322602&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/objc-property-declaration.m Tue Jan 
16 16:19:35 2018
@@ -7,6 +7,7 @@
 // CHECK-FIXES: @property(assign, nonatomic) int notCamelCase;
 @property(assign, nonatomic) int camelCase;
 @property(strong, nonatomic) NSString *URLString;
+@property(strong, nonatomic) NSString *bundleID;
 @property(strong, nonatomic) NSString *URL_string;
 // CHECK-MESSAGES: :[[@LINE-1]]:40: warning: property name 'URL_string' should 
use lowerCamelCase style, according to the Apple Coding Guidelines 
[objc-property-declaration]
 @end


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r319460 - add new check to find NSError init invocation

2017-12-01 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Thu Nov 30 11:05:09 2017
New Revision: 319460

URL: http://llvm.org/viewvc/llvm-project?rev=319460&view=rev
Log:
add new check to find NSError init invocation

Subscribers: klimek, mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D40528

Added:
clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp
  - copied, changed from r319459, 
clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.h
  - copied, changed from r319459, 
clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h
Removed:
clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h
Modified:
clang-tools-extra/trunk/docs/ReleaseNotes.rst

Copied: clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp (from 
r319459, clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp)
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp?p2=clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.cpp&p1=clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp&r1=319459&r2=319460&rev=319460&view=diff
==
(empty)

Copied: clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.h (from 
r319459, clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h)
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.h?p2=clang-tools-extra/trunk/clang-tidy/objc/AvoidNSErrorInitCheck.h&p1=clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h&r1=319459&r2=319460&rev=319460&view=diff
==
(empty)

Removed: clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp?rev=319459&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp (removed)
@@ -1,37 +0,0 @@
-//===--- AvoidNSErrorInitCheck.cpp - 
clang-tidy===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#include "AvoidNSErrorInitCheck.h"
-#include "clang/AST/ASTContext.h"
-#include "clang/ASTMatchers/ASTMatchFinder.h"
-
-using namespace clang::ast_matchers;
-
-namespace clang {
-namespace tidy {
-namespace objc {
-
-void AvoidNSErrorInitCheck::registerMatchers(MatchFinder *Finder) {
-  Finder->addMatcher(objcMessageExpr(hasSelector("init"),
- hasReceiverType(asString("NSError *")))
- .bind("nserrorInit"),
- this);
-}
-
-void AvoidNSErrorInitCheck::check(const MatchFinder::MatchResult &Result) {
-  const auto *MatchedExpr =
-  Result.Nodes.getNodeAs("nserrorInit");
-  diag(MatchedExpr->getLocStart(),
-   "use errorWithDomain:code:userInfo: or initWithDomain:code:userInfo: to 
"
-   "create a new NSError");
-}
-
-}  // namespace objc
-}  // namespace tidy
-}  // namespace clang

Removed: clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h?rev=319459&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h (original)
+++ clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h (removed)
@@ -1,36 +0,0 @@
-//===--- AvoidNSErrorInitCheck.h - clang-tidy*- C++ 
-*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-
-#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOIDNSERRORINITCHECK_H
-#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOIDNSERRORINITCHECK_H
-
-#include "../ClangTidy.h"
-
-namespace clang {
-namespace tidy {
-namespace objc {
-
-/// Finds usages of [NSSError init]. It is not the proper way of creating
-/// NSError. errorWithDomain:code:userInfo: should be used instead.
-///
-/// For the user-facing documentation see:
-/// http://clang.llvm.org/extra/clang-tidy/checks/objc-avoid-nserror-init.html
-class AvoidNSErrorInitCheck : public ClangTidyCheck {
- public:
-  AvoidNSErrorInitCheck(St

[clang-tools-extra] r319459 - add new check to find NSError init invocation

2017-12-01 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Thu Nov 30 11:05:08 2017
New Revision: 319459

URL: http://llvm.org/viewvc/llvm-project?rev=319459&view=rev
Log:
add new check to find NSError init invocation

Summary:
This check will find out improper initialization of NSError objects.

According to Apple developer document, we should always use factory method 
errorWithDomain:code:userInfo: to create new NSError objects instead of 
[NSError alloc] init]. Otherwise it will lead to a warning message during 
runtime in Xcode.

The corresponding information about NSError creation: 
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ErrorHandlingCocoa/CreateCustomizeNSError/CreateCustomizeNSError.html

Reviewers: hokein, benhamilton

Reviewed By: benhamilton

Subscribers: klimek, mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D40528

Added:
clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp
clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h
clang-tools-extra/trunk/docs/clang-tidy/checks/objc-avoid-nserror-init.rst
clang-tools-extra/trunk/test/clang-tidy/objc-avoid-nserror-init.m
Modified:
clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/objc/ObjCTidyModule.cpp
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Added: clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp?rev=319459&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.cpp Thu Nov 
30 11:05:08 2017
@@ -0,0 +1,37 @@
+//===--- AvoidNSErrorInitCheck.cpp - 
clang-tidy===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "AvoidNSErrorInitCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace objc {
+
+void AvoidNSErrorInitCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(objcMessageExpr(hasSelector("init"),
+ hasReceiverType(asString("NSError *")))
+ .bind("nserrorInit"),
+ this);
+}
+
+void AvoidNSErrorInitCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *MatchedExpr =
+  Result.Nodes.getNodeAs("nserrorInit");
+  diag(MatchedExpr->getLocStart(),
+   "use errorWithDomain:code:userInfo: or initWithDomain:code:userInfo: to 
"
+   "create a new NSError");
+}
+
+}  // namespace objc
+}  // namespace tidy
+}  // namespace clang

Added: clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h?rev=319459&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h (added)
+++ clang-tools-extra/trunk/clang-tidy/objc/AvoidNserrorInitCheck.h Thu Nov 30 
11:05:08 2017
@@ -0,0 +1,36 @@
+//===--- AvoidNSErrorInitCheck.h - clang-tidy*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOIDNSERRORINITCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOIDNSERRORINITCHECK_H
+
+#include "../ClangTidy.h"
+
+namespace clang {
+namespace tidy {
+namespace objc {
+
+/// Finds usages of [NSSError init]. It is not the proper way of creating
+/// NSError. errorWithDomain:code:userInfo: should be used instead.
+///
+/// For the user-facing documentation see:
+/// http://clang.llvm.org/extra/clang-tidy/checks/objc-avoid-nserror-init.html
+class AvoidNSErrorInitCheck : public ClangTidyCheck {
+ public:
+  AvoidNSErrorInitCheck(StringRef Name, ClangTidyContext *Context)
+  : ClangTidyCheck(Name, Context) {}
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+};
+
+}  // namespace objc
+}  // namespace tidy
+}  // namespace clang
+
+#endif  // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOIDNSERRORINITCHECK_H

Modified: clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-pr

[clang-tools-extra] r319098 - add new check to find OSSpinlock usage

2017-11-27 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Mon Nov 27 13:30:10 2017
New Revision: 319098

URL: http://llvm.org/viewvc/llvm-project?rev=319098&view=rev
Log:
add new check to find OSSpinlock usage

Summary:
This check finds the use of methods related to OSSpinlock in Objective-C code, 
which should be deprecated due to livelock issues.
The following method call will be detected:

- OSSpinlockLock()
- OSSpinlockTry()
- OSSpinlockUnlcok()

Reviewers: hokein, benhamilton

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits, mgorny

Differential Revision: https://reviews.llvm.org/D40325

Added:
clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.cpp
clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.h
clang-tools-extra/trunk/docs/clang-tidy/checks/objc-avoid-spinlock.rst
clang-tools-extra/trunk/test/clang-tidy/objc-avoid-spinlock.m
Modified:
clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/objc/ObjCTidyModule.cpp
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Added: clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.cpp?rev=319098&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.cpp Mon Nov 27 
13:30:10 2017
@@ -0,0 +1,37 @@
+//===--- AvoidSpinlockCheck.cpp - 
clang-tidy---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "AvoidSpinlockCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace objc {
+
+void AvoidSpinlockCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(
+  callExpr(callee((functionDecl(hasAnyName(
+   "OSSpinlockLock", "OSSpinlockUnlock", "OSSpinlockTry")
+  .bind("spinlock"),
+  this);
+}
+
+void AvoidSpinlockCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *MatchedExpr = Result.Nodes.getNodeAs("spinlock");
+  diag(MatchedExpr->getLocStart(),
+   "use os_unfair_lock_lock() or dispatch queue APIs instead of the "
+   "deprecated OSSpinLock");
+}
+
+}  // namespace objc
+}  // namespace tidy
+}  // namespace clang

Added: clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.h?rev=319098&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.h (added)
+++ clang-tools-extra/trunk/clang-tidy/objc/AvoidSpinlockCheck.h Mon Nov 27 
13:30:10 2017
@@ -0,0 +1,36 @@
+//===--- AvoidSpinlockCheck.h - clang-tidy---*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOID_SPINLOCK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOID_SPINLOCK_H
+
+#include "../ClangTidy.h"
+
+namespace clang {
+namespace tidy {
+namespace objc {
+
+/// Finds usages of OSSpinlock, which is deprecated due to potential livelock
+/// problems.
+///
+/// For the user-facing documentation see:
+/// http://clang.llvm.org/extra/clang-tidy/checks/objc-avoid-spinlock.html
+class AvoidSpinlockCheck : public ClangTidyCheck {
+ public:
+  AvoidSpinlockCheck(StringRef Name, ClangTidyContext *Context)
+  : ClangTidyCheck(Name, Context) {}
+  void registerMatchers(ast_matchers::MatchFinder *Finder) override;
+  void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+};
+
+}  // namespace objc
+}  // namespace tidy
+}  // namespace clang
+
+#endif  // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOID_SPINLOCK_H

Modified: clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt?rev=319098&r1=319097&r2=319098&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/objc/CMakeLists.txt Mon Nov 27 13:30:10 
2017
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS support)
 
 add_clang_library(clangTidyObjCModule
+  AvoidSpinlockCheck.

[clang-tools-extra] r318366 - add check to avoid throwing objc exception according to Google Objective-C guide

2017-11-15 Thread Yan Zhang via cfe-commits
Author: wizard
Date: Wed Nov 15 17:28:29 2017
New Revision: 318366

URL: http://llvm.org/viewvc/llvm-project?rev=318366&view=rev
Log:
add check to avoid throwing objc exception according to Google Objective-C guide

Summary:
This is a small check to avoid throwing objc exceptions.
In specific it will detect the usage of @throw statement and throw warning.

Reviewers: hokein, benhamilton

Reviewed By: hokein, benhamilton

Subscribers: cfe-commits, mgorny

Differential Revision: https://reviews.llvm.org/D40058

Added:

clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp
clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.h

clang-tools-extra/trunk/docs/clang-tidy/checks/google-objc-avoid-throwing-exception.rst

clang-tools-extra/trunk/test/clang-tidy/google-objc-avoid-throwing-exception.m
Modified:
clang-tools-extra/trunk/clang-tidy/google/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/google/GoogleTidyModule.cpp
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Added: 
clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp?rev=318366&view=auto
==
--- 
clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp 
(added)
+++ 
clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp 
Wed Nov 15 17:28:29 2017
@@ -0,0 +1,47 @@
+//===--- AvoidThrowingObjCExceptionCheck.cpp - 
clang-tidy--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "AvoidThrowingObjCExceptionCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace google {
+namespace objc {
+
+void AvoidThrowingObjCExceptionCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(objcThrowStmt().bind("throwStmt"), this);
+  Finder->addMatcher(
+  objcMessageExpr(anyOf(hasSelector("raise:format:"),
+hasSelector("raise:format:arguments:")),
+  hasReceiverType(asString("NSException")))
+  .bind("raiseException"),
+  this);
+}
+
+void AvoidThrowingObjCExceptionCheck::check(
+const MatchFinder::MatchResult &Result) {
+  const auto *MatchedStmt =
+  Result.Nodes.getNodeAs("throwStmt");
+  const auto *MatchedExpr =
+  Result.Nodes.getNodeAs("raiseException");
+  auto SourceLoc = MatchedStmt == nullptr ? MatchedExpr->getSelectorStartLoc()
+  : MatchedStmt->getThrowLoc();
+  diag(SourceLoc,
+   "pass in NSError ** instead of throwing exception to indicate "
+   "Objective-C errors");
+}
+
+}  // namespace objc
+}  // namespace google
+}  // namespace tidy
+}  // namespace clang

Added: 
clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.h?rev=318366&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.h 
(added)
+++ clang-tools-extra/trunk/clang-tidy/google/AvoidThrowingObjCExceptionCheck.h 
Wed Nov 15 17:28:29 2017
@@ -0,0 +1,39 @@
+//===--- AvoidThrowingObjCExceptionCheck.h - clang-tidy--*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef 
LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_OBJC_AVOID_THROWING_EXCEPTION_H
+#define 
LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_OBJC_AVOID_THROWING_EXCEPTION_H
+
+#include "../ClangTidy.h"
+
+namespace clang {
+namespace tidy {
+namespace google {
+namespace objc {
+
+/// The check is to find usage of @throw invocation in Objective-C code.
+/// We should avoid using @throw for Objective-C exceptions according to
+/// the Google Objective-C Style Guide.
+///
+/// For the user-facing documentation see:
+/// 
http://clang.llvm.org/extra/clang-tidy/checks/google-objc-avoid-throwing-exception.html
+class AvoidThrowingObjCExceptionCheck : public ClangTidyCheck {
+ public:
+  AvoidThrowingObjCExceptionCheck(StringRef Name, ClangTidyContext *Context)
+  : ClangTidyCheck(Name, Context) {}
+  void registerMatchers(ast_matchers::MatchFinder *Finder) overrid