[Sema][ObjC] Infer availability of +new from availability of -init.
When defined in NSObject, +new will call -init. If -init has been marked
unavailable, diagnose uses of +new.
rdar://18335828
Differential revision: https://reviews.llvm.org/D51189
llvm-svn: 341874
diff --git a/clang/lib/AST/NSAPI.cpp b/clang/lib/AST/NSAPI.cpp
index 94ad87b..9d59131 100644
--- a/clang/lib/AST/NSAPI.cpp
+++ b/clang/lib/AST/NSAPI.cpp
@@ -607,3 +607,11 @@
}
return Sel;
}
+
+Selector NSAPI::getOrInitNullarySelector(StringRef Id, Selector &Sel) const {
+ if (Sel.isNull()) {
+ IdentifierInfo *Ident = &Ctx.Idents.get(Id);
+ Sel = Ctx.Selectors.getSelector(0, &Ident);
+ }
+ return Sel;
+}