In code-completion contexts where both types and other values are

present, prefer values to types, since it's more common to compute
with values than it is to declare new entities or perform type
casts. So, tweak the ranking of types vs. other declarations and
constants accordingly.

llvm-svn: 111998
This commit is contained in:
Douglas Gregor 2010-08-24 23:40:45 +00:00
parent 7d46051eea
commit 45140a9040
7 changed files with 37 additions and 37 deletions

View File

@ -40,12 +40,12 @@ enum {
CCP_Keyword = 30,
/// \brief Priority for a code pattern.
CCP_CodePattern = 30,
/// \brief Priority for a type.
CCP_Type = 40,
/// \brief Priority for a non-type declaration.
CCP_Declaration = 50,
/// \brief Priority for a constant value (e.g., enumerator).
CCP_Constant = 60,
/// \brief Priority for a type.
CCP_Type = 65,
/// \brief Priority for a preprocessor macro.
CCP_Macro = 70,
/// \brief Priority for a nested-name-specifier.

View File

@ -58,8 +58,8 @@ Z::operator int() const {
// CHECK-OVERLOAD: NotImplemented:{ResultType double &}{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}
// RUN: c-index-test -code-completion-at=%s:37:10 %s | FileCheck -check-prefix=CHECK-EXPR %s
// CHECK-EXPR: NotImplemented:{TypedText int} (40)
// CHECK-EXPR: NotImplemented:{TypedText long} (40)
// CHECK-EXPR: NotImplemented:{TypedText int} (65)
// CHECK-EXPR: NotImplemented:{TypedText long} (65)
// CHECK-EXPR: FieldDecl:{ResultType double}{TypedText member} (10)
// CHECK-EXPR: FieldDecl:{ResultType int}{Text X::}{TypedText member} (5)
// CHECK-EXPR: FieldDecl:{ResultType float}{Text Y::}{TypedText member} (11)

View File

@ -34,6 +34,6 @@ struct Z {
// CHECK-CC4: NotImplemented:{TypedText N}{Text ::} (75)
// CHECK-CC4: NotImplemented:{TypedText operator} (30)
// CHECK-CC4: NotImplemented:{TypedText volatile} (30)
// CHECK-CC4: StructDecl:{TypedText Y} (40)
// CHECK-CC4: StructDecl:{TypedText Y} (65)
// CHECK-CC4: StructDecl:{TypedText Z} (20)

View File

@ -23,7 +23,7 @@ void f4(const char* str) {
// CHECK-CC1: NotImplemented:{TypedText __PRETTY_FUNCTION__} (60)
// CHECK-CC1: macro definition:{TypedText __VERSION__} (70)
// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) (unavailable)
// CHECK-CC1-NOT: NotImplemented:{TypedText float} (40)
// CHECK-CC1-NOT: NotImplemented:{TypedText float} (65)
// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (2)
// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1a %s
@ -36,7 +36,7 @@ void f4(const char* str) {
// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
// CHECK-CC3: macro definition:{TypedText __VERSION__} (70)
// CHECK-CC3: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
// CHECK-CC3-NOT: NotImplemented:{TypedText float} (40)
// CHECK-CC3-NOT: NotImplemented:{TypedText float} (65)
// CHECK-CC3: ParmDecl:{ResultType int}{TypedText j} (8)
// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expressio
@ -45,7 +45,7 @@ void f4(const char* str) {
// RUN: c-index-test -code-completion-at=%s:7:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: macro definition:{TypedText __VERSION__} (70)
// CHECK-CC2: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
// CHECK-CC2: NotImplemented:{TypedText float} (40)
// CHECK-CC2: NotImplemented:{TypedText float} (65)
// CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (8)
// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
// RUN: c-index-test -code-completion-at=%s:11:16 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
@ -53,10 +53,10 @@ void f4(const char* str) {
// CHECK-CC4: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)
// RUN: c-index-test -code-completion-at=%s:13:28 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5: NotImplemented:{TypedText void} (40)
// CHECK-CC5: NotImplemented:{TypedText volatile} (40)
// CHECK-CC5: NotImplemented:{TypedText void} (65)
// CHECK-CC5: NotImplemented:{TypedText volatile} (65)
// RUN: c-index-test -code-completion-at=%s:19:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
// CHECK-CC6: FunctionDecl:{ResultType void}{TypedText f3}{LeftParen (}{Placeholder char const *}{Placeholder , ...}{Text , NULL}{RightParen )} (50)
// CHECK-CC6: NotImplemented:{TypedText void} (40)
// CHECK-CC6: NotImplemented:{TypedText volatile} (40)
// CHECK-CC6: NotImplemented:{TypedText void} (65)
// CHECK-CC6: NotImplemented:{TypedText volatile} (65)

View File

@ -23,7 +23,7 @@ void f() {
// CHECK-CC1-NOT: VarDecl:{ResultType int}{TypedText ValueA} (50)
// CHECK-CC1: VarDecl:{ResultType int}{TypedText ValueB} (50)
// RUN: c-index-test -code-completion-at=%s:16:10 %s | FileCheck -check-prefix=CHECK-CC2 %s
// CHECK-CC2: StructDecl:{TypedText StructA} (40)
// CHECK-CC2-NOT: StructDecl:{TypedText StructB} (40)
// CHECK-CC2: StructDecl:{TypedText StructC} (40)
// CHECK-CC2: StructDecl:{TypedText StructA} (65)
// CHECK-CC2-NOT: StructDecl:{TypedText StructB} (65)
// CHECK-CC2: StructDecl:{TypedText StructC} (65)
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:16:10 %s | FileCheck -check-prefix=CHECK-CC2 %s

View File

@ -121,39 +121,39 @@
// CHECK-CCE: ObjCInstanceMethodDecl:{ResultType id}{Informative first:}{Informative second2:}{TypedText third:}{Text (double)z} (20)
// CHECK-CCE: ObjCInstanceMethodDecl:{ResultType int}{Informative first:}{Informative second2:}{TypedText third:}{Text (double)z} (5)
// RUN: c-index-test -code-completion-at=%s:60:4 %s | FileCheck -check-prefix=CHECK-CCF %s
// CHECK-CCF: ObjCInterfaceDecl:{TypedText A} (40)
// CHECK-CCF: ObjCInterfaceDecl:{TypedText B} (40)
// CHECK-CCF: ObjCInterfaceDecl:{TypedText A} (65)
// CHECK-CCF: ObjCInterfaceDecl:{TypedText B} (65)
// CHECK-CCF: NotImplemented:{TypedText bycopy} (30)
// CHECK-CCF: NotImplemented:{TypedText byref} (30)
// CHECK-CCF: NotImplemented:{TypedText in} (30)
// CHECK-CCF: NotImplemented:{TypedText inout} (30)
// CHECK-CCF: NotImplemented:{TypedText oneway} (30)
// CHECK-CCF: NotImplemented:{TypedText out} (30)
// CHECK-CCF: NotImplemented:{TypedText unsigned} (40)
// CHECK-CCF: NotImplemented:{TypedText void} (40)
// CHECK-CCF: NotImplemented:{TypedText volatile} (40)
// CHECK-CCF: NotImplemented:{TypedText unsigned} (65)
// CHECK-CCF: NotImplemented:{TypedText void} (65)
// CHECK-CCF: NotImplemented:{TypedText volatile} (65)
// RUN: c-index-test -code-completion-at=%s:60:11 %s | FileCheck -check-prefix=CHECK-CCG %s
// CHECK-CCG: ObjCInterfaceDecl:{TypedText A} (40)
// CHECK-CCG: ObjCInterfaceDecl:{TypedText B} (40)
// CHECK-CCG: ObjCInterfaceDecl:{TypedText A} (65)
// CHECK-CCG: ObjCInterfaceDecl:{TypedText B} (65)
// CHECK-CCG-NOT: NotImplemented:{TypedText bycopy} (30)
// CHECK-CCG-NOT: NotImplemented:{TypedText byref} (30)
// CHECK-CCG: NotImplemented:{TypedText in} (30)
// CHECK-CCG: NotImplemented:{TypedText inout} (30)
// CHECK-CCG-NOT: NotImplemented:{TypedText oneway} (30)
// CHECK-CCG: NotImplemented:{TypedText out} (30)
// CHECK-CCG: NotImplemented:{TypedText unsigned} (40)
// CHECK-CCG: NotImplemented:{TypedText void} (40)
// CHECK-CCG: NotImplemented:{TypedText volatile} (40)
// CHECK-CCG: NotImplemented:{TypedText unsigned} (65)
// CHECK-CCG: NotImplemented:{TypedText void} (65)
// CHECK-CCG: NotImplemented:{TypedText volatile} (65)
// RUN: c-index-test -code-completion-at=%s:60:24 %s | FileCheck -check-prefix=CHECK-CCF %s
// RUN: c-index-test -code-completion-at=%s:60:26 %s | FileCheck -check-prefix=CHECK-CCH %s
// CHECK-CCH: ObjCInterfaceDecl:{TypedText A} (40)
// CHECK-CCH: ObjCInterfaceDecl:{TypedText B} (40)
// CHECK-CCH: ObjCInterfaceDecl:{TypedText A} (65)
// CHECK-CCH: ObjCInterfaceDecl:{TypedText B} (65)
// CHECK-CCH: NotImplemented:{TypedText bycopy} (30)
// CHECK-CCH: NotImplemented:{TypedText byref} (30)
// CHECK-CCH-NOT: NotImplemented:{TypedText in} (30)
// CHECK-CCH: NotImplemented:{TypedText inout} (30)
// CHECK-CCH: NotImplemented:{TypedText oneway} (30)
// CHECK-CCH: NotImplemented:{TypedText out} (30)
// CHECK-CCH: NotImplemented:{TypedText unsigned} (40)
// CHECK-CCH: NotImplemented:{TypedText void} (40)
// CHECK-CCH: NotImplemented:{TypedText volatile} (40)
// CHECK-CCH: NotImplemented:{TypedText unsigned} (65)
// CHECK-CCH: NotImplemented:{TypedText void} (65)
// CHECK-CCH: NotImplemented:{TypedText volatile} (65)

View File

@ -61,13 +61,13 @@ FOO(in,t) value;
// CHECK-CC4: macro definition:{TypedText BAR} (70)
// CHECK-CC4: macro definition:{TypedText FOO}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (70)
// RUN: c-index-test -code-completion-at=%s:14:5 %s | FileCheck -check-prefix=CHECK-CC5 %s
// CHECK-CC5: NotImplemented:{TypedText const} (40)
// CHECK-CC5: NotImplemented:{TypedText double} (40)
// CHECK-CC5: NotImplemented:{TypedText enum} (40)
// CHECK-CC5: NotImplemented:{TypedText const} (65)
// CHECK-CC5: NotImplemented:{TypedText double} (65)
// CHECK-CC5: NotImplemented:{TypedText enum} (65)
// CHECK-CC5: NotImplemented:{TypedText extern} (30)
// CHECK-CC5: NotImplemented:{TypedText float} (40)
// CHECK-CC5: NotImplemented:{TypedText float} (65)
// CHECK-CC5: macro definition:{TypedText FOO}{LeftParen (}{Placeholder a}{Comma , }{Placeholder b}{RightParen )} (70)
// CHECK-CC5: TypedefDecl:{TypedText id} (40)
// CHECK-CC5: TypedefDecl:{TypedText id} (65)
// CHECK-CC5: NotImplemented:{TypedText inline} (30)
// CHECK-CC5: NotImplemented:{TypedText int} (40)
// CHECK-CC5: NotImplemented:{TypedText long} (40)
// CHECK-CC5: NotImplemented:{TypedText int} (65)
// CHECK-CC5: NotImplemented:{TypedText long} (65)