[PATCH] D66269: [clang-tidy] Migrate objc-forbidden-subclassing to use isDerivedFrom 🚛

2019-08-20 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment.

LGTM, thanks!


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66269



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


[PATCH] D66269: [clang-tidy] Migrate objc-forbidden-subclassing to use isDerivedFrom 🚛

2019-08-15 Thread Stephane Moore via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369076: [clang-tidy] Migrate objc-forbidden-subclassing to 
use isDerivedFrom 🚛 (authored by stephanemoore, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D66269?vs=215305&id=215519#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D66269

Files:
  clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp


Index: clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
@@ -37,33 +37,6 @@
 "UITextInputMode;"
 "UIWebView";
 
-/// \brief Matches Objective-C classes that directly or indirectly
-/// have a superclass matching \c Base.
-///
-/// Note that a class is not considered to be a subclass of itself.
-///
-/// Example matches Y, Z
-/// (matcher = objcInterfaceDecl(hasName("X")))
-/// \code
-///   @interface X
-///   @end
-///   @interface Y : X  // directly derived
-///   @end
-///   @interface Z : Y  // indirectly derived
-///   @end
-/// \endcode
-AST_MATCHER_P(ObjCInterfaceDecl, isSubclassOf,
-  ast_matchers::internal::Matcher, Base) {
-  for (const auto *SuperClass = Node.getSuperClass();
-   SuperClass != nullptr;
-   SuperClass = SuperClass->getSuperClass()) {
-if (Base.matches(*SuperClass, Finder, Builder)) {
-  return true;
-}
-  }
-  return false;
-}
-
 } // namespace
 
 ForbiddenSubclassingCheck::ForbiddenSubclassingCheck(
@@ -82,7 +55,7 @@
 
   Finder->addMatcher(
   objcInterfaceDecl(
-  isSubclassOf(
+  isDerivedFrom(
   objcInterfaceDecl(
   hasAnyName(
   std::vector(


Index: clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
@@ -37,33 +37,6 @@
 "UITextInputMode;"
 "UIWebView";
 
-/// \brief Matches Objective-C classes that directly or indirectly
-/// have a superclass matching \c Base.
-///
-/// Note that a class is not considered to be a subclass of itself.
-///
-/// Example matches Y, Z
-/// (matcher = objcInterfaceDecl(hasName("X")))
-/// \code
-///   @interface X
-///   @end
-///   @interface Y : X  // directly derived
-///   @end
-///   @interface Z : Y  // indirectly derived
-///   @end
-/// \endcode
-AST_MATCHER_P(ObjCInterfaceDecl, isSubclassOf,
-  ast_matchers::internal::Matcher, Base) {
-  for (const auto *SuperClass = Node.getSuperClass();
-   SuperClass != nullptr;
-   SuperClass = SuperClass->getSuperClass()) {
-if (Base.matches(*SuperClass, Finder, Builder)) {
-  return true;
-}
-  }
-  return false;
-}
-
 } // namespace
 
 ForbiddenSubclassingCheck::ForbiddenSubclassingCheck(
@@ -82,7 +55,7 @@
 
   Finder->addMatcher(
   objcInterfaceDecl(
-  isSubclassOf(
+  isDerivedFrom(
   objcInterfaceDecl(
   hasAnyName(
   std::vector(
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D66269: [clang-tidy] Migrate objc-forbidden-subclassing to use isDerivedFrom 🚛

2019-08-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66269



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


[PATCH] D66269: [clang-tidy] Migrate objc-forbidden-subclassing to use isDerivedFrom 🚛

2019-08-14 Thread Stephane Moore via Phabricator via cfe-commits
stephanemoore created this revision.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.

This migrates objc-forbidden-subclassing to `isDerivedFrom` as it now
supports matching Objective-C interface declarations.

Test Notes:
Ran clang tools tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D66269

Files:
  clang-tools-extra/clang-tidy/objc/ForbiddenSubclassingCheck.cpp


Index: clang-tools-extra/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
===
--- clang-tools-extra/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
+++ clang-tools-extra/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
@@ -37,33 +37,6 @@
 "UITextInputMode;"
 "UIWebView";
 
-/// \brief Matches Objective-C classes that directly or indirectly
-/// have a superclass matching \c Base.
-///
-/// Note that a class is not considered to be a subclass of itself.
-///
-/// Example matches Y, Z
-/// (matcher = objcInterfaceDecl(hasName("X")))
-/// \code
-///   @interface X
-///   @end
-///   @interface Y : X  // directly derived
-///   @end
-///   @interface Z : Y  // indirectly derived
-///   @end
-/// \endcode
-AST_MATCHER_P(ObjCInterfaceDecl, isSubclassOf,
-  ast_matchers::internal::Matcher, Base) {
-  for (const auto *SuperClass = Node.getSuperClass();
-   SuperClass != nullptr;
-   SuperClass = SuperClass->getSuperClass()) {
-if (Base.matches(*SuperClass, Finder, Builder)) {
-  return true;
-}
-  }
-  return false;
-}
-
 } // namespace
 
 ForbiddenSubclassingCheck::ForbiddenSubclassingCheck(
@@ -82,7 +55,7 @@
 
   Finder->addMatcher(
   objcInterfaceDecl(
-  isSubclassOf(
+  isDerivedFrom(
   objcInterfaceDecl(
   hasAnyName(
   std::vector(


Index: clang-tools-extra/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
===
--- clang-tools-extra/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
+++ clang-tools-extra/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
@@ -37,33 +37,6 @@
 "UITextInputMode;"
 "UIWebView";
 
-/// \brief Matches Objective-C classes that directly or indirectly
-/// have a superclass matching \c Base.
-///
-/// Note that a class is not considered to be a subclass of itself.
-///
-/// Example matches Y, Z
-/// (matcher = objcInterfaceDecl(hasName("X")))
-/// \code
-///   @interface X
-///   @end
-///   @interface Y : X  // directly derived
-///   @end
-///   @interface Z : Y  // indirectly derived
-///   @end
-/// \endcode
-AST_MATCHER_P(ObjCInterfaceDecl, isSubclassOf,
-  ast_matchers::internal::Matcher, Base) {
-  for (const auto *SuperClass = Node.getSuperClass();
-   SuperClass != nullptr;
-   SuperClass = SuperClass->getSuperClass()) {
-if (Base.matches(*SuperClass, Finder, Builder)) {
-  return true;
-}
-  }
-  return false;
-}
-
 } // namespace
 
 ForbiddenSubclassingCheck::ForbiddenSubclassingCheck(
@@ -82,7 +55,7 @@
 
   Finder->addMatcher(
   objcInterfaceDecl(
-  isSubclassOf(
+  isDerivedFrom(
   objcInterfaceDecl(
   hasAnyName(
   std::vector(
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits