Tweak code completions for Objective-C Key-Value Observing. The
+keyPathsForValuesAffecting<Key> completion was mislabeled as an instance method, and +automaticallyNotifiesObserversOf<Key> was missing entirely. Fixes <rdar://problem/9516762>. llvm-svn: 132452
This commit is contained in:
@@ -6188,7 +6188,28 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property,
|
||||
|
||||
Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName));
|
||||
Results.AddResult(Result(Builder.TakeString(), CCP_CodePattern,
|
||||
CXCursor_ObjCInstanceMethodDecl));
|
||||
CXCursor_ObjCClassMethodDecl));
|
||||
}
|
||||
}
|
||||
|
||||
// + (BOOL)automaticallyNotifiesObserversForKey
|
||||
if (!IsInstanceMethod &&
|
||||
(ReturnType.isNull() ||
|
||||
ReturnType->isIntegerType() ||
|
||||
ReturnType->isBooleanType())) {
|
||||
std::string SelectorName
|
||||
= (llvm::Twine("automaticallyNotifiesObserversOf") + UpperKey).str();
|
||||
IdentifierInfo *SelectorId = &Context.Idents.get(SelectorName);
|
||||
if (KnownSelectors.insert(Selectors.getNullarySelector(SelectorId))) {
|
||||
if (ReturnType.isNull()) {
|
||||
Builder.AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Builder.AddTextChunk("BOOL");
|
||||
Builder.AddChunk(CodeCompletionString::CK_RightParen);
|
||||
}
|
||||
|
||||
Builder.AddTypedTextChunk(Allocator.CopyString(SelectorName));
|
||||
Results.AddResult(Result(Builder.TakeString(), CCP_CodePattern,
|
||||
CXCursor_ObjCClassMethodDecl));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user