[PATCH] D75569: [clang-tidy] New check for methods marked __attribute__((unavailable)) that do not override a method from a superclass.

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 5 15:53:46 PST 2020


njames93 added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/objc/MethodUnavailableNotOverrideCheck.cpp:47-49
+  auto Iter =
+      std::find(Macros.begin(), Macros.end(), Tok.getRawIdentifier().str());
+  return Iter != Macros.end();
----------------
`return llvm::is_contained(Macros, Tok.getRawIdentifier().str())`


================
Comment at: clang-tools-extra/clang-tidy/objc/MethodUnavailableNotOverrideCheck.cpp:52
+
+static FixItHint
+fixItRemovingUnavailableMethod(const ObjCMethodDecl *MD,
----------------
Should probably return an `llvm::Optional<FixItHint>`


================
Comment at: clang-tools-extra/clang-tidy/objc/MethodUnavailableNotOverrideCheck.cpp:80
+void MethodUnavailableNotOverrideCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().ObjC)
+    return;
----------------
This check is surplus to requirements now that there is the `isLanguageVersionSupported` check


================
Comment at: clang-tools-extra/clang-tidy/objc/MethodUnavailableNotOverrideCheck.cpp:84
+  Finder->addMatcher(
+      objcMethodDecl(allOf(hasAttr(clang::attr::Unavailable), isNotOverriding(),
+                           hasDeclContext(objcInterfaceDecl())))
----------------
`objcMethodDecl` is implicitly an `allOf` matcher, so there is no need to specify `allOf`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75569





More information about the cfe-commits mailing list