diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-18 15:16:27 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-18 15:16:27 +0000 |
commit | 97fe61ca1749110c28eb4570a710c8983711c7b3 (patch) | |
tree | d633ec7ae41ad70f3d18638d2c302e6595d2b1a1 /lib/Sema/CodeCompleteConsumer.cpp | |
parent | 38c9b1765c56406e97510889b465b7885ccb59f3 (diff) |
Give the Objective-C _cmd an "unlikely" code completion priority; it's
very rarely used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114286 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/CodeCompleteConsumer.cpp')
-rw-r--r-- | lib/Sema/CodeCompleteConsumer.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp index 58a1627b47..3322782d87 100644 --- a/lib/Sema/CodeCompleteConsumer.cpp +++ b/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; } |