[PATCH] D51189: [Sema][ObjC] Infer availability of +new from availability of -init
Alex Lorenz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 24 10:32:12 PDT 2018
arphaman added a comment.
That's probably the best solution then, I don't think declaring implicit `new` just for availability attribute is sound.
Does this work with `self new` as well?
================
Comment at: clang/lib/AST/DeclObjC.cpp:833
+bool ObjCMethodDecl::definedInNSObject(const ASTContext &Ctx) const {
+ if (const ObjCProtocolDecl *PD =
+ dyn_cast<const ObjCProtocolDecl>(getDeclContext()))
----------------
`const auto`
================
Comment at: clang/lib/AST/DeclObjC.cpp:836
+ return PD->getIdentifier() == Ctx.getNSObjectName();
+ if (const ObjCInterfaceDecl *ID =
+ dyn_cast<const ObjCInterfaceDecl>(getDeclContext())) {
----------------
`const auto`
================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:6951
+ std::string *Message,
+ ObjCInterfaceDecl *ClassMessageReceiver) {
AvailabilityResult Result = D->getAvailability(Message);
----------------
Please be consistent with the name, you are using `ClassMessageReceiver`, `ClassReceiver` and `Receiver` in different arguments in this patch.
================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:6986
+ if (const auto *MD = dyn_cast<ObjCMethodDecl>(D)) {
+ if (S.NSAPIObj != nullptr && ClassMessageReceiver != nullptr) {
+ ObjCMethodDecl *Init = ClassMessageReceiver->lookupInstanceMethod(
----------------
Comparisons to `nullptr` are redundant, you can just say `S.NSAPIObj && ClassMessageReceiver`. Same below.
Repository:
rC Clang
https://reviews.llvm.org/D51189
More information about the cfe-commits
mailing list