summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-01-06 12:00:44 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-01-06 12:00:44 +0000
commit6e0f393e12edf108ab4ab6f34b13dcddd88390d8 (patch)
treeaed18c8c2da7c26e32f8e284acb85c9435b49688 /clang/lib
parentc7dc1a2a3c0c3584596be495f81d75b9d2881993 (diff)
downloadbcm5719-llvm-6e0f393e12edf108ab4ab6f34b13dcddd88390d8.tar.gz
bcm5719-llvm-6e0f393e12edf108ab4ab6f34b13dcddd88390d8.zip
[CodeCompletion] Block property setters: Use dynamic priority heuristic
Now when completing blocks properties that return void the block call completion result shows up before the setter, otherwise the setter completion shows up before the block call completion. We normally want to use the result of the block call, so one typically wouldn't call a block that returns a non-void type in a standalone statement. rdar://28846153 Differential Revision: https://reviews.llvm.org/D26034 llvm-svn: 291232
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaCodeComplete.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 3eef366b75b..94cfc4baca5 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -3720,9 +3720,17 @@ static void AddObjCProperties(
Builder.AddPlaceholderChunk(
Builder.getAllocator().CopyString(PlaceholderStr));
+ // When completing blocks properties that return void the default
+ // property completion result should show up before the setter,
+ // otherwise the setter completion should show up before the default
+ // property completion, as we normally want to use the result of the
+ // call.
Results.MaybeAddResult(
Result(Builder.TakeString(), P,
- Results.getBasePriority(P) + CCD_BlockPropertySetter),
+ Results.getBasePriority(P) +
+ (BlockLoc.getTypePtr()->getReturnType()->isVoidType()
+ ? CCD_BlockPropertySetter
+ : -CCD_BlockPropertySetter)),
CurContext);
}
};
OpenPOWER on IntegriCloud