aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/CodeCompleteConsumer.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-18 15:16:27 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-18 15:16:27 +0000
commit521db40c15e001a30bab28346941fe20f437dc5d (patch)
tree179913713cb47481d5be8bf7c2bdbd02381dd921 /clang/lib/Sema/CodeCompleteConsumer.cpp
parent57e599a82a3da86d825f830afe337cf98fc97aa1 (diff)
downloadllvm-521db40c15e001a30bab28346941fe20f437dc5d.zip
llvm-521db40c15e001a30bab28346941fe20f437dc5d.tar.gz
llvm-521db40c15e001a30bab28346941fe20f437dc5d.tar.bz2
Give the Objective-C _cmd an "unlikely" code completion priority; it's
very rarely used. llvm-svn: 114286
Diffstat (limited to 'clang/lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r--clang/lib/Sema/CodeCompleteConsumer.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp
index 58a1627..3322782 100644
--- a/clang/lib/Sema/CodeCompleteConsumer.cpp
+++ b/clang/lib/Sema/CodeCompleteConsumer.cpp
@@ -389,8 +389,15 @@ unsigned CodeCompletionResult::getPriorityFromDecl(NamedDecl *ND) {
// Context-based decisions.
DeclContext *DC = ND->getDeclContext()->getRedeclContext();
- if (DC->isFunctionOrMethod() || isa<BlockDecl>(DC))
+ if (DC->isFunctionOrMethod() || isa<BlockDecl>(DC)) {
+ // _cmd is relatively rare
+ if (ImplicitParamDecl *ImplicitParam = dyn_cast<ImplicitParamDecl>(ND))
+ if (ImplicitParam->getIdentifier() &&
+ ImplicitParam->getIdentifier()->isStr("_cmd"))
+ return CCP_ObjC_cmd;
+
return CCP_LocalDeclaration;
+ }
if (DC->isRecord() || isa<ObjCContainerDecl>(DC))
return CCP_MemberDeclaration;
@@ -399,6 +406,7 @@ unsigned CodeCompletionResult::getPriorityFromDecl(NamedDecl *ND) {
return CCP_Constant;
if (isa<TypeDecl>(ND) || isa<ObjCInterfaceDecl>(ND))
return CCP_Type;
+
return CCP_Declaration;
}