[PATCH] D59806: [clang-tidy] Add a check for [super self] in initializers 🔍

Stephane Moore via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 29 16:20:11 PDT 2019


stephanemoore marked 3 inline comments as done.
stephanemoore added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/objc/SuperSelfCheck.cpp:112
+      << Message->getMethodDecl()
+      << FixItHint::CreateReplacement(Message->getSourceRange(),
+                                      StringRef("[super init]"));
----------------
stephanemoore wrote:
> aaron.ballman wrote:
> > This could be dangerous if the `[super self]` construct is in a macro, couldn't it? e.g.,
> > ```
> > #define DERP self
> > 
> > [super DERP];
> > ```
> Good point. Let me add some test cases and make sure this is handled properly.
Added some test cases where `[super self]` is expanded from macros.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59806





More information about the cfe-commits mailing list