]> granicus.if.org Git - clang/commitdiff
In code-completion contexts where both types and other values are
authorDouglas Gregor <dgregor@apple.com>
Tue, 24 Aug 2010 23:40:45 +0000 (23:40 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 24 Aug 2010 23:40:45 +0000 (23:40 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111998 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Sema/CodeCompleteConsumer.h
test/Index/code-completion.cpp
test/Index/complete-declarators.cpp
test/Index/complete-exprs.c
test/Index/complete-hiding.c
test/Index/complete-method-decls.m
test/Index/complete-preprocessor.m

index 8b5a741ebd1c37dd5498e88910fdef39471d9b17..87974f1452178deb5630d90caec7f312a0c0f5c9 100644 (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.
index cd0317f153ef9f34d7ee1f3e20654f1c2e878aee..354e7461660a5a9fb4037491435177ca26efe6c2 100644 (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)
index ba16e22ec1f2046ae8cffb1027a8783e832db98b..61d776589237a96c830fc14d2d2deb821b7a57fd 100644 (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)
 
index a94b7f6f771d98ce5d64716b8912840b280b3122..f64706c866dfe9de29734345b4a08f079b276679 100644 (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)
index 0505abfa4784d7f79556cd9b855e235ca3ad93a6..f2e177571c0c0780502f1bb39230c526eea80602 100644 (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
index 20f6c600783cf2b33d293ee922c0b6c124be207d..5a5ee6963ab6d0431e6934c78d0a99efe2ab8bf0 100644 (file)
 // 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)
index 5a20c1c333038f9daa3a306a4259b7767d768c93..6ca7214fa2e98f2fcbe8f39b30807dfe32fc2062 100644 (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)