[PATCH] D25520: [CodeCompletion] Add block placeholders when completing member access for Objective-C block property setters
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 12 09:10:47 PDT 2016
arphaman created this revision.
arphaman added reviewers: manmanren, doug.gregor.
arphaman added a subscriber: cfe-commits.
arphaman set the repository for this revision to rL LLVM.
This patch depends on https://reviews.llvm.org/D25519.
This patch changes the way that Objective-C block properties are code complete: clang now suggests completion with an additional '=' and the block literal placeholder when providing member access completions for appropriate readwrite block properties. This patch uses a simple heuristic to determine if it's appropriate to suggest a setter completion for block properties: if we are completing member access that is a standalone statement, we provide setter completion. Otherwise we fallback to the default property completion.
The following example illustrates when the setter completion is triggered:
@interface Test : Obj
@property (readonly, nonatomic, copy) void (^onReadonly)(int *someParameter);
@end
@implementation Test
- foo {
self.<COMPLETION> // will complete with ‘=‘ and block
}
- fooNot {
// These will code complete normally:
(self.<COMPLETION>)
return self.<COMPLETION>
[self foo: self.<COMPLETION>]
if (self.<COMPLETION>) { }
}
@end
Repository:
rL LLVM
https://reviews.llvm.org/D25520
Files:
include/clang/Parse/Parser.h
include/clang/Sema/Sema.h
lib/Parse/ParseExpr.cpp
lib/Parse/ParseStmt.cpp
lib/Sema/SemaCodeComplete.cpp
test/Index/complete-block-property-assignment.m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25520.74390.patch
Type: text/x-patch
Size: 13736 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161012/bc30e2e8/attachment.bin>
More information about the cfe-commits
mailing list