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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 29 04:06:29 PDT 2019


aaron.ballman added reviewers: jordan_rose, rjmccall.
aaron.ballman added a comment.

I think this basically LGTM, but I'd appreciate hearing from someone more well-versed in ObjC before landing this. My primary question is: are there situations where `[super self]` is sensible (if so, how should the user silence the diagnostic; will `NOLINT` suffice or be too annoying), and are there any other circumstances where the fix-it is dangerous that we should be concerned by?



================
Comment at: clang-tools-extra/clang-tidy/objc/SuperSelfCheck.cpp:112
+      << Message->getMethodDecl()
+      << FixItHint::CreateReplacement(Message->getSourceRange(),
+                                      StringRef("[super init]"));
----------------
This could be dangerous if the `[super self]` construct is in a macro, couldn't it? e.g.,
```
#define DERP self

[super DERP];
```


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