stephanemoore added inline comments.

================
Comment at: clang-tools-extra/clang-tidy/objc/DeallocInCategoriesCheck.cpp:19
+
+void DeallocInCategoriesCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(
----------------
Early return if the language is not an Objective-C variant:
```
  // This check should only be applied to Objective-C sources.
  if (!getLangOpts().ObjC)
    return;
```


================
Comment at: clang-tools-extra/clang-tidy/objc/DeallocInCategoriesCheck.cpp:21
+  Finder->addMatcher(
+      objcMethodDecl(hasName("dealloc"), 
hasDeclContext(objcCategoryImplDecl()))
+          .bind("dealloc"),
----------------
stephanemoore wrote:
> Add `isInstanceMethod()` within the `objcMethodDecl`?
Technically, isn't `-dealloc` specific to certain classes, e.g., 
[`NSObject`](https://developer.apple.com/documentation/objectivec/nsobject/1571947-dealloc?language=objc))
 and 
[NSProxy](https://developer.apple.com/documentation/foundation/nsproxy/1589830-dealloc?language=objc)?
 If that is true, we should technically check that the category is on a class 
that is or is derived from a relevant class like `NSObject` or `NSProxy`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72876/new/

https://reviews.llvm.org/D72876



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

Reply via email to