CCP_NestedNameSpecifier = 75,
/// \brief Priority for a result that isn't likely to be what the user wants,
/// but is included for completeness.
- CCP_Unlikely = 80
+ CCP_Unlikely = 80,
+
+ /// \brief Priority for the Objective-C "_cmd" implicit parameter.
+ CCP_ObjC_cmd = CCP_Unlikely
};
/// \brief Priority value deltas that are added to code-completion results
// 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;
return CCP_Constant;
if (isa<TypeDecl>(ND) || isa<ObjCInterfaceDecl>(ND))
return CCP_Type;
+
return CCP_Declaration;
}
--- /dev/null
+@interface A
+- (int)method:(id)param1;
+
+@property int prop1;
+@end
+
+@implementation A
+- (int)method:(id)param1 {
+
+}
+@end
+
+// RUN: c-index-test -code-completion-at=%s:9:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: NotImplemented:{ResultType SEL}{TypedText _cmd} (80)
+// CHECK-CC1: NotImplemented:{ResultType A *}{TypedText self} (8)