From ab0b4f1d66de54b4c3102b96d56964510361ba7d Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 13 Jan 2010 23:24:38 +0000 Subject: [PATCH] Improve the sorting of code-completion results. We now always sort by the "typed" text, first, then take into account nested-name-specifiers, name hiding, etc. This means that the resulting sort is actually alphabetical :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93370 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/CodeCompleteConsumer.cpp | 11 +- lib/Sema/SemaCodeComplete.cpp | 79 ++--- .../enum-switch-case-qualified.cpp | 14 +- test/CodeCompletion/enum-switch-case.c | 10 +- test/CodeCompletion/enum-switch-case.cpp | 10 +- test/CodeCompletion/macros.c | 15 +- test/CodeCompletion/member-access.cpp | 22 +- test/CodeCompletion/namespace-alias.cpp | 10 +- test/CodeCompletion/namespace.cpp | 4 +- test/CodeCompletion/nested-name-specifier.cpp | 6 +- test/CodeCompletion/objc-message.m | 16 +- test/CodeCompletion/operator.cpp | 12 +- test/CodeCompletion/ordinary-name.c | 7 +- test/CodeCompletion/ordinary-name.cpp | 321 +++++++++--------- test/CodeCompletion/tag.c | 4 +- test/CodeCompletion/tag.cpp | 16 +- test/CodeCompletion/truncation.c | 10 +- test/CodeCompletion/using-namespace.cpp | 10 +- test/CodeCompletion/using.cpp | 12 +- test/Index/code-completion.cpp | 12 +- test/Index/complete-at-directives.m | 4 +- test/Index/complete-at-exprstmt.m | 12 +- test/Index/complete-objc-message.m | 2 +- 23 files changed, 312 insertions(+), 307 deletions(-) diff --git a/lib/Sema/CodeCompleteConsumer.cpp b/lib/Sema/CodeCompleteConsumer.cpp index 0a00b4226d..fbd14502b7 100644 --- a/lib/Sema/CodeCompleteConsumer.cpp +++ b/lib/Sema/CodeCompleteConsumer.cpp @@ -426,8 +426,7 @@ PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef, OS << "COMPLETION: "; switch (Results[I].Kind) { case Result::RK_Declaration: - OS << Results[I].Declaration->getNameAsString() << " : " - << Results[I].Rank; + OS << Results[I].Declaration->getNameAsString() ; if (Results[I].Hidden) OS << " (Hidden)"; if (CodeCompletionString *CCS @@ -440,13 +439,13 @@ PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef, break; case Result::RK_Keyword: - OS << Results[I].Keyword << " : " << Results[I].Rank << '\n'; + OS << Results[I].Keyword << '\n'; break; case Result::RK_Macro: { - OS << Results[I].Macro->getName() << " : " << Results[I].Rank; + OS << Results[I].Macro->getName(); if (CodeCompletionString *CCS - = Results[I].CreateCodeCompletionString(SemaRef)) { + = Results[I].CreateCodeCompletionString(SemaRef)) { OS << " : " << CCS->getAsString(); delete CCS; } @@ -455,7 +454,7 @@ PrintingCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef, } case Result::RK_Pattern: { - OS << "Pattern : " << Results[I].Rank << " : " + OS << "Pattern : " << Results[I].Pattern->getAsString() << '\n'; break; } diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index b828a02255..2a8be96ede 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -1889,29 +1889,49 @@ namespace { Y.getAsString()) < 0; } - bool operator()(const Result &X, const Result &Y) const { - // Sort first by rank. - if (X.Rank < Y.Rank) - return true; - else if (X.Rank > Y.Rank) - return false; - - // We use a special ordering for keywords and patterns, based on the - // typed text. - if ((X.Kind == Result::RK_Keyword || X.Kind == Result::RK_Pattern) && - (Y.Kind == Result::RK_Keyword || Y.Kind == Result::RK_Pattern)) { - const char *XStr = (X.Kind == Result::RK_Keyword)? X.Keyword - : X.Pattern->getTypedText(); - const char *YStr = (Y.Kind == Result::RK_Keyword)? Y.Keyword - : Y.Pattern->getTypedText(); - return llvm::StringRef(XStr).compare_lower(YStr) < 0; + /// \brief Retrieve the name that should be used to order a result. + /// + /// If the name needs to be constructed as a string, that string will be + /// saved into Saved and the returned StringRef will refer to it. + static llvm::StringRef getOrderedName(const Result &R, + std::string &Saved) { + switch (R.Kind) { + case Result::RK_Keyword: + return R.Keyword; + + case Result::RK_Pattern: + return R.Pattern->getTypedText(); + + case Result::RK_Macro: + return R.Macro->getName(); + + case Result::RK_Declaration: + // Handle declarations below. + break; } + + DeclarationName Name = R.Declaration->getDeclName(); - // Result kinds are ordered by decreasing importance. - if (X.Kind < Y.Kind) - return true; - else if (X.Kind > Y.Kind) - return false; + // If the name is a simple identifier (by far the common case), or a + // zero-argument selector, just return a reference to that identifier. + if (IdentifierInfo *Id = Name.getAsIdentifierInfo()) + return Id->getName(); + if (Name.isObjCZeroArgSelector()) + if (IdentifierInfo *Id + = Name.getObjCSelector().getIdentifierInfoForSlot(0)) + return Id->getName(); + + Saved = Name.getAsString(); + return Saved; + } + + bool operator()(const Result &X, const Result &Y) const { + std::string XSaved, YSaved; + llvm::StringRef XStr = getOrderedName(X, XSaved); + llvm::StringRef YStr = getOrderedName(Y, YSaved); + int cmp = XStr.compare_lower(YStr); + if (cmp) + return cmp < 0; // Non-hidden names precede hidden names. if (X.Hidden != Y.Hidden) @@ -1921,23 +1941,6 @@ namespace { if (X.StartsNestedNameSpecifier != Y.StartsNestedNameSpecifier) return !X.StartsNestedNameSpecifier; - // Ordering depends on the kind of result. - switch (X.Kind) { - case Result::RK_Declaration: - // Order based on the declaration names. - return isEarlierDeclarationName(X.Declaration->getDeclName(), - Y.Declaration->getDeclName()); - - case Result::RK_Macro: - return X.Macro->getName().compare_lower(Y.Macro->getName()) < 0; - - case Result::RK_Keyword: - case Result::RK_Pattern: - llvm_unreachable("Result kinds handled above"); - break; - } - - // Silence GCC warning. return false; } }; diff --git a/test/CodeCompletion/enum-switch-case-qualified.cpp b/test/CodeCompletion/enum-switch-case-qualified.cpp index d441269336..b9efcb43ed 100644 --- a/test/CodeCompletion/enum-switch-case-qualified.cpp +++ b/test/CodeCompletion/enum-switch-case-qualified.cpp @@ -22,11 +22,11 @@ void test(enum N::C::Color color) { switch (color) { case // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:8 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: Blue : 0 : [#enum M::N::C::Color#]N::C::Blue - // CHECK-CC1-NEXT: Green : 0 : [#enum M::N::C::Color#]N::C::Green - // CHECK-CC1-NEXT: Indigo : 0 : [#enum M::N::C::Color#]N::C::Indigo - // CHECK-CC1-NEXT: Orange : 0 : [#enum M::N::C::Color#]N::C::Orange - // CHECK-CC1-NEXT: Red : 0 : [#enum M::N::C::Color#]N::C::Red - // CHECK-CC1-NEXT: Violet : 0 : [#enum M::N::C::Color#]N::C::Violet - // CHECK-CC1: Yellow : 0 : [#enum M::N::C::Color#]N::C::Yellow + // CHECK-CC1: Blue : [#enum M::N::C::Color#]N::C::Blue + // CHECK-CC1-NEXT: Green : [#enum M::N::C::Color#]N::C::Green + // CHECK-CC1-NEXT: Indigo : [#enum M::N::C::Color#]N::C::Indigo + // CHECK-CC1-NEXT: Orange : [#enum M::N::C::Color#]N::C::Orange + // CHECK-CC1-NEXT: Red : [#enum M::N::C::Color#]N::C::Red + // CHECK-CC1-NEXT: Violet : [#enum M::N::C::Color#]N::C::Violet + // CHECK-CC1: Yellow : [#enum M::N::C::Color#]N::C::Yellow diff --git a/test/CodeCompletion/enum-switch-case.c b/test/CodeCompletion/enum-switch-case.c index 1a7c58fc1e..082072600f 100644 --- a/test/CodeCompletion/enum-switch-case.c +++ b/test/CodeCompletion/enum-switch-case.c @@ -20,9 +20,9 @@ void test(enum Color color) { break; // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:10 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: Blue : 0 - // CHECK-CC1-NEXT: Green : 0 - // CHECK-CC1-NEXT: Indigo : 0 - // CHECK-CC1-NEXT: Orange : 0 - // CHECK-CC1-NEXT: Violet : 0 + // CHECK-CC1: Blue + // CHECK-CC1-NEXT: Green + // CHECK-CC1-NEXT: Indigo + // CHECK-CC1-NEXT: Orange + // CHECK-CC1-NEXT: Violet diff --git a/test/CodeCompletion/enum-switch-case.cpp b/test/CodeCompletion/enum-switch-case.cpp index ee8facae0d..412f5f2f07 100644 --- a/test/CodeCompletion/enum-switch-case.cpp +++ b/test/CodeCompletion/enum-switch-case.cpp @@ -20,9 +20,9 @@ void test(enum N::Color color) { case // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:21:8 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: Blue : 0 : [#enum N::Color#]N::Blue - // CHECK-CC1-NEXT: Green : 0 : [#enum N::Color#]N::Green - // CHECK-CC1-NEXT: Indigo : 0 : [#enum N::Color#]N::Indigo - // CHECK-CC1-NEXT: Orange : 0 : [#enum N::Color#]N::Orange - // CHECK-CC1-NEXT: Violet : 0 : [#enum N::Color#]N::Violet + // CHECK-CC1: Blue : [#enum N::Color#]N::Blue + // CHECK-CC1-NEXT: Green : [#enum N::Color#]N::Green + // CHECK-CC1-NEXT: Indigo : [#enum N::Color#]N::Indigo + // CHECK-CC1-NEXT: Orange : [#enum N::Color#]N::Orange + // CHECK-CC1-NEXT: Violet : [#enum N::Color#]N::Violet diff --git a/test/CodeCompletion/macros.c b/test/CodeCompletion/macros.c index f8861e912b..6330d25172 100644 --- a/test/CodeCompletion/macros.c +++ b/test/CodeCompletion/macros.c @@ -19,19 +19,20 @@ void test(struct Point *p) { // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:12:14 %s -o - | FileCheck -check-prefix=CC1 %s // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:14:9 %s -o - | FileCheck -check-prefix=CC2 %s - // CC1: color - // CC1: x - // CC1: y - // CC1: z // CC1: BAR(<#X#>, <#Y#>) + // CC1: color // CC1: FOO // CC1: IDENTITY(<#X#>) // CC1: WIBBLE - // CC2: Blue - // CC2: Green - // CC2: Red + // CC1: x + // CC1: y + // CC1: z + // CC2: BAR(<#X#>, <#Y#>) + // CC2: Blue // CC2: FOO + // CC2: Green // CC2: IDENTITY(<#X#>) + // CC2: Red // CC2: WIBBLE } diff --git a/test/CodeCompletion/member-access.cpp b/test/CodeCompletion/member-access.cpp index 7d1637c272..8f772c0652 100644 --- a/test/CodeCompletion/member-access.cpp +++ b/test/CodeCompletion/member-access.cpp @@ -28,15 +28,15 @@ public: void test(const Proxy &p) { p-> // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s - // CHECK-CC1: member1 : 0 : [#int#][#Base1::#]member1 - // CHECK-CC1: member1 : 0 : [#int#][#Base2::#]member1 - // CHECK-CC1: member2 : 0 : [#float#][#Base1::#]member2 - // CHECK-CC1: member3 : 0 - // CHECK-CC1: member4 : 0 - // CHECK-CC1: memfun1 : 0 : [#void#][#Base3::#]memfun1(<#float#>) - // CHECK-CC1: memfun1 : 0 : [#void#][#Base3::#]memfun1(<#double#>)[# const#] - // CHECK-CC1: memfun2 : 0 : [#void#][#Base3::#]memfun2(<#int#>) - // CHECK-CC1: memfun3 : 0 : [#int#]memfun3(<#int#>) - // CHECK-CC1: memfun1 : 0 (Hidden) : [#void#]Base2::memfun1(<#int#>) - // CHECK-CC1: Base1 : 3 : Base1:: + // CHECK-CC1: Base1 : Base1:: + // CHECK-CC1: member1 : [#int#][#Base1::#]member1 + // CHECK-CC1: member1 : [#int#][#Base2::#]member1 + // CHECK-CC1: member2 : [#float#][#Base1::#]member2 + // CHECK-CC1: member3 + // CHECK-CC1: member4 + // CHECK-CC1: memfun1 : [#void#][#Base3::#]memfun1(<#float#>) + // CHECK-CC1: memfun1 : [#void#][#Base3::#]memfun1(<#double#>)[# const#] + // CHECK-CC1: memfun1 (Hidden) : [#void#]Base2::memfun1(<#int#>) + // CHECK-CC1: memfun2 : [#void#][#Base3::#]memfun2(<#int#>) + // CHECK-CC1: memfun3 : [#int#]memfun3(<#int#>) diff --git a/test/CodeCompletion/namespace-alias.cpp b/test/CodeCompletion/namespace-alias.cpp index 4511662147..efbf996372 100644 --- a/test/CodeCompletion/namespace-alias.cpp +++ b/test/CodeCompletion/namespace-alias.cpp @@ -12,9 +12,9 @@ namespace N2 { namespace New = // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:18 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: I1 : 1 - // CHECK-CC1: I4 : 1 - // CHECK-CC1: I5 : 1 - // CHECK-CC1: N2 : 3 - // CHECK-CC1-NEXT: N4 : 3 + // CHECK-CC1: I1 + // CHECK-CC1: I4 + // CHECK-CC1: I5 + // CHECK-CC1: N2 + // CHECK-CC1-NEXT: N4 diff --git a/test/CodeCompletion/namespace.cpp b/test/CodeCompletion/namespace.cpp index 8a421122b0..ecd848039a 100644 --- a/test/CodeCompletion/namespace.cpp +++ b/test/CodeCompletion/namespace.cpp @@ -9,6 +9,6 @@ namespace N2 { namespace // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:12 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: I1 : 0 - // CHECK-CC1-NEXT: I5 : 0 + // CHECK-CC1: I1 + // CHECK-CC1-NEXT: I5 diff --git a/test/CodeCompletion/nested-name-specifier.cpp b/test/CodeCompletion/nested-name-specifier.cpp index 643418accd..e09a14b4cb 100644 --- a/test/CodeCompletion/nested-name-specifier.cpp +++ b/test/CodeCompletion/nested-name-specifier.cpp @@ -11,7 +11,7 @@ namespace N { N:: // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:12:4 %s -o - | FileCheck -check-prefix=CC1 %s -// CHECK-CC1: A : 0 -// CHECK-CC1: B : 0 -// CHECK-CC1: M : 0 +// CHECK-CC1: A +// CHECK-CC1: B +// CHECK-CC1: M diff --git a/test/CodeCompletion/objc-message.m b/test/CodeCompletion/objc-message.m index a1ae271bbe..a7b111f59e 100644 --- a/test/CodeCompletion/objc-message.m +++ b/test/CodeCompletion/objc-message.m @@ -24,12 +24,12 @@ void func() { [obj xx]; } // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:19 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s -// CHECK-CC1: categoryClassMethod : 0 -// CHECK-CC1: classMethod1:withKeyword: : 0 -// CHECK-CC1: classMethod2 : 0 -// CHECK-CC1: new : 0 -// CHECK-CC1: protocolClassMethod : 0 +// CHECK-CC1: categoryClassMethod +// CHECK-CC1: classMethod1:withKeyword: +// CHECK-CC1: classMethod2 +// CHECK-CC1: new +// CHECK-CC1: protocolClassMethod // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:24:8 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s -// CHECK-CC2: categoryInstanceMethod : 0 -// CHECK-CC2: instanceMethod1 : 0 -// CHECK-CC2: protocolInstanceMethod : 0 +// CHECK-CC2: categoryInstanceMethod +// CHECK-CC2: instanceMethod1 +// CHECK-CC2: protocolInstanceMethod diff --git a/test/CodeCompletion/operator.cpp b/test/CodeCompletion/operator.cpp index eef7fbd17b..05cd7684ad 100644 --- a/test/CodeCompletion/operator.cpp +++ b/test/CodeCompletion/operator.cpp @@ -9,9 +9,9 @@ void f() { operator // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:11 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: Float : 0 - // CHECK-CC1: + : 0 - // CHECK-CC1: short : 0 - // CHECK-CC1: Integer : 2 - // CHECK-CC1: T : 2 - // CHECK-CC1: N : 6 + // CHECK-CC1: + + // CHECK-CC1: Float + // CHECK-CC1: Integer + // CHECK-CC1: N + // CHECK-CC1: short + // CHECK-CC1: T diff --git a/test/CodeCompletion/ordinary-name.c b/test/CodeCompletion/ordinary-name.c index 7f5a05ff75..1580d01fd3 100644 --- a/test/CodeCompletion/ordinary-name.c +++ b/test/CodeCompletion/ordinary-name.c @@ -5,7 +5,6 @@ typedef struct t TYPEDEF; void foo() { int y; // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s - // CHECK-CC1: y : 0 - // CHECK-CC1: foo : 2 - // CHECK-NOT-CC1: y : 2 - // CHECK-CC1-NEXT: TYPEDEF : 2 + // CHECK-CC1: foo + // CHECK-CC1: y + // CHECK-CC1: TYPEDEF diff --git a/test/CodeCompletion/ordinary-name.cpp b/test/CodeCompletion/ordinary-name.cpp index 99573e8507..d938c79eae 100644 --- a/test/CodeCompletion/ordinary-name.cpp +++ b/test/CodeCompletion/ordinary-name.cpp @@ -5,166 +5,167 @@ typedef struct t TYPEDEF; void foo() { int y = 17; // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:14 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s - // CHECK-CC1: COMPLETION: y : 0 : [#int#]y - // CHECK-CC1-NEXT: COMPLETION: foo : 2 : [#void#]foo() - // CHECK-CC1-NEXT: COMPLETION: t : 2 : t - // CHECK-CC1-NEXT: COMPLETION: TYPEDEF : 2 : TYPEDEF - // CHECK-CC1-NEXT: COMPLETION: X : 2 : X - // CHECK-CC1-NOT: x - // CHECK-CC1-NEXT: COMPLETION: z : 2 : [#void#]z(<#int#>) - // CHECK-CC1-NEXT: COMPLETION: bool : 3 - // CHECK-CC1-NEXT: COMPLETION: char : 3 - // CHECK-CC1-NEXT: COMPLETION: class : 3 - // CHECK-CC1-NEXT: COMPLETION: const : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : const_cast<<#type-id#>>(<#expression#>) - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : delete <#expression#> - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : delete[] <#expression#> - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : do{<#statements#> - // CHECK-CC1: COMPLETION: double : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : dynamic_cast<<#type-id#>>(<#expression#>) - // CHECK-CC1-NEXT: COMPLETION: enum : 3 - // CHECK-CC1-NEXT: COMPLETION: extern : 3 - // CHECK-CC1-NEXT: COMPLETION: false : 3 - // CHECK-CC1-NEXT: COMPLETION: float : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : for(<#init-statement#>;<#condition#>;<#inc-expression#>){<#statements#> - // CHECK-CC1: COMPLETION: Pattern : 3 : goto <#identifier#>; - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : if(<#condition#>){<#statements#> - // CHECK-CC1: COMPLETION: int : 3 - // CHECK-CC1-NEXT: COMPLETION: long : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : new <#type-id#>(<#expressions#>) - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : new <#type-id#>[<#size#>](<#expressions#>) - // CHECK-CC1-NEXT: COMPLETION: operator : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : reinterpret_cast<<#type-id#>>(<#expression#>) - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : return; - // CHECK-CC1-NEXT: COMPLETION: short : 3 - // CHECK-CC1-NEXT: COMPLETION: signed : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : sizeof(<#expression-or-type#>) - // CHECK-CC1-NEXT: COMPLETION: static : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : static_cast<<#type-id#>>(<#expression#>) - // CHECK-CC1-NEXT: COMPLETION: struct : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : switch(<#condition#>){ - // CHECK-CC1: COMPLETION: Pattern : 3 : throw <#expression#> - // CHECK-CC1-NEXT: COMPLETION: true : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : try{<#statements#> - // CHECK-CC1: COMPLETION: typedef : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : typeid(<#expression-or-type#>) - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : typename <#qualified-id#> - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : typeof(<#expression-or-type#>) - // CHECK-CC1-NEXT: COMPLETION: union : 3 - // CHECK-CC1-NEXT: COMPLETION: unsigned : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : using namespace <#identifier#>; - // CHECK-CC1-NEXT: COMPLETION: void : 3 - // CHECK-CC1-NEXT: COMPLETION: volatile : 3 - // CHECK-CC1-NEXT: COMPLETION: wchar_t : 3 - // CHECK-CC1-NEXT: COMPLETION: Pattern : 3 : while(<#condition#>){<#statements#> + // CHECK-CC1: COMPLETION: bool + // CHECK-CC1-NEXT: COMPLETION: char + // CHECK-CC1-NEXT: COMPLETION: class + // CHECK-CC1-NEXT: COMPLETION: const + // CHECK-CC1-NEXT: COMPLETION: Pattern : const_cast<<#type-id#>>(<#expression#>) + // CHECK-CC1: COMPLETION: Pattern : delete <#expression#> + // CHECK-CC1-NEXT: COMPLETION: Pattern : delete[] <#expression#> + // CHECK-CC1-NEXT: COMPLETION: Pattern : do{<#statements#> + // CHECK-CC1: COMPLETION: double + // CHECK-CC1-NEXT: COMPLETION: Pattern : dynamic_cast<<#type-id#>>(<#expression#>) + // CHECK-CC1-NEXT: COMPLETION: enum + // CHECK-CC1-NEXT: COMPLETION: extern + // CHECK-CC1-NEXT: COMPLETION: false + // CHECK-CC1-NEXT: COMPLETION: float + // CHECK-CC1-NEXT: COMPLETION: foo : [#void#]foo() + // CHECK-CC1-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){<#statements#> + // CHECK-CC1: COMPLETION: Pattern : goto <#identifier#>; + // CHECK-CC1-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#> + // CHECK-CC1: COMPLETION: int + // CHECK-CC1-NEXT: COMPLETION: long + // CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type-id#>(<#expressions#>) + // CHECK-CC1-NEXT: COMPLETION: Pattern : new <#type-id#>[<#size#>](<#expressions#>) + // CHECK-CC1-NEXT: COMPLETION: operator + // CHECK-CC1-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type-id#>>(<#expression#>) + // CHECK-CC1-NEXT: COMPLETION: Pattern : return; + // CHECK-CC1-NEXT: COMPLETION: short + // CHECK-CC1-NEXT: COMPLETION: signed + // CHECK-CC1-NEXT: COMPLETION: Pattern : sizeof(<#expression-or-type#>) + // CHECK-CC1-NEXT: COMPLETION: static + // CHECK-CC1-NEXT: COMPLETION: Pattern : static_cast<<#type-id#>>(<#expression#>) + // CHECK-CC1-NEXT: COMPLETION: struct + // CHECK-CC1-NEXT: COMPLETION: Pattern : switch(<#condition#>){ + // CHECK-CC1: COMPLETION: t : t + // CHECK-CC1-NEXT: COMPLETION: Pattern : throw <#expression#> + // CHECK-CC1-NEXT: COMPLETION: true + // CHECK-CC1-NEXT: COMPLETION: Pattern : try{<#statements#> + // CHECK-CC1: COMPLETION: TYPEDEF : TYPEDEF + // CHECK-CC1-NEXT: COMPLETION: typedef + // CHECK-CC1-NEXT: COMPLETION: Pattern : typeid(<#expression-or-type#>) + // CHECK-CC1-NEXT: COMPLETION: Pattern : typename <#qualified-id#> + // CHECK-CC1-NEXT: COMPLETION: Pattern : typeof(<#expression-or-type#>) + // CHECK-CC1-NEXT: COMPLETION: union + // CHECK-CC1-NEXT: COMPLETION: unsigned + // CHECK-CC1-NEXT: COMPLETION: Pattern : using namespace <#identifier#>; + // CHECK-CC1-NEXT: COMPLETION: void + // CHECK-CC1-NEXT: COMPLETION: volatile + // CHECK-CC1-NEXT: COMPLETION: wchar_t + // CHECK-CC1-NEXT: COMPLETION: Pattern : while(<#condition#>){<#statements#> + // CHECK-CC1: COMPLETION: X : X + // CHECK-CC1-NEXT: COMPLETION: y : [#int#]y + // CHECK-CC1-NEXT: COMPLETION: z : [#void#]z(<#int#>) + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:1 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s - // CHECK-CC2: COMPLETION: t : 1 : t - // CHECK-CC2-NEXT: COMPLETION: TYPEDEF : 1 : TYPEDEF - // CHECK-CC2-NEXT: COMPLETION: X : 1 : X - // CHECK-CC2-NOT: COMPLETION: z - // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : asm(<#string-literal#>); - // CHECK-CC2-NEXT: COMPLETION: bool : 2 - // CHECK-CC2-NEXT: COMPLETION: char : 2 - // CHECK-CC2-NEXT: COMPLETION: class : 2 - // CHECK-CC2-NEXT: COMPLETION: const : 2 - // CHECK-CC2-NEXT: COMPLETION: double : 2 - // CHECK-CC2-NEXT: COMPLETION: enum : 2 - // CHECK-CC2-NEXT: COMPLETION: extern : 2 - // CHECK-CC2-NEXT: COMPLETION: float : 2 - // CHECK-CC2-NEXT: COMPLETION: inline : 2 - // CHECK-CC2-NEXT: COMPLETION: int : 2 - // CHECK-CC2-NEXT: COMPLETION: long : 2 - // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : namespace <#identifier#>{<#declarations#> - // CHECK-CC2: COMPLETION: Pattern : 2 : namespace <#identifier#> = <#identifier#>; - // CHECK-CC2-NEXT: COMPLETION: operator : 2 - // CHECK-CC2-NEXT: COMPLETION: short : 2 - // CHECK-CC2-NEXT: COMPLETION: signed : 2 - // CHECK-CC2-NEXT: COMPLETION: static : 2 - // CHECK-CC2-NEXT: COMPLETION: struct : 2 - // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : template <#declaration#>; - // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : template<<#parameters#>> - // CHECK-CC2-NEXT: COMPLETION: typedef : 2 - // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : typename <#qualified-id#> - // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : typeof(<#expression-or-type#>) - // CHECK-CC2-NEXT: COMPLETION: union : 2 - // CHECK-CC2-NEXT: COMPLETION: unsigned : 2 - // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : using namespace <#identifier#>; - // CHECK-CC2-NEXT: COMPLETION: Pattern : 2 : using <#qualified-id#>; - // CHECK-CC2-NEXT: COMPLETION: void : 2 - // CHECK-CC2-NEXT: COMPLETION: volatile : 2 - // CHECK-CC2-NEXT: COMPLETION: wchar_t : 2 + // CHECK-CC2: COMPLETION: Pattern : asm(<#string-literal#>); + // CHECK-CC2-NEXT: COMPLETION: bool + // CHECK-CC2-NEXT: COMPLETION: char + // CHECK-CC2-NEXT: COMPLETION: class + // CHECK-CC2-NEXT: COMPLETION: const + // CHECK-CC2-NEXT: COMPLETION: double + // CHECK-CC2-NEXT: COMPLETION: enum + // CHECK-CC2-NEXT: COMPLETION: extern + // CHECK-CC2-NEXT: COMPLETION: float + // CHECK-CC2-NEXT: COMPLETION: inline + // CHECK-CC2-NEXT: COMPLETION: int + // CHECK-CC2-NEXT: COMPLETION: long + // CHECK-CC2-NEXT: COMPLETION: Pattern : namespace <#identifier#>{<#declarations#> + // CHECK-CC2: COMPLETION: Pattern : namespace <#identifier#> = <#identifier#>; + // CHECK-CC2-NEXT: COMPLETION: operator + // CHECK-CC2-NEXT: COMPLETION: short + // CHECK-CC2-NEXT: COMPLETION: signed + // CHECK-CC2-NEXT: COMPLETION: static + // CHECK-CC2-NEXT: COMPLETION: struct + // CHECK-CC2-NEXT: COMPLETION: t : t + // CHECK-CC2-NEXT: COMPLETION: Pattern : template <#declaration#>; + // CHECK-CC2-NEXT: COMPLETION: Pattern : template<<#parameters#>> + // CHECK-CC2-NEXT: COMPLETION: TYPEDEF : TYPEDEF + // CHECK-CC2-NEXT: COMPLETION: typedef + // CHECK-CC2-NEXT: COMPLETION: Pattern : typename <#qualified-id#> + // CHECK-CC2-NEXT: COMPLETION: Pattern : typeof(<#expression-or-type#>) + // CHECK-CC2-NEXT: COMPLETION: union + // CHECK-CC2-NEXT: COMPLETION: unsigned + // CHECK-CC2-NEXT: COMPLETION: Pattern : using namespace <#identifier#>; + // CHECK-CC2-NEXT: COMPLETION: Pattern : using <#qualified-id#>; + // CHECK-CC2-NEXT: COMPLETION: void + // CHECK-CC2-NEXT: COMPLETION: volatile + // CHECK-CC2-NEXT: COMPLETION: wchar_t + // CHECK-CC2-NEXT: COMPLETION: X : X + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:1:19 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s - // CHECK-CC3: COMPLETION: X : 1 : X - // CHECK-CC3-NEXT: COMPLETION: bool : 4 - // CHECK-CC3-NEXT: COMPLETION: char : 4 - // CHECK-CC3-NEXT: COMPLETION: class : 4 - // CHECK-CC3-NEXT: COMPLETION: const : 4 - // CHECK-CC3-NEXT: COMPLETION: double : 4 - // CHECK-CC3-NEXT: COMPLETION: enum : 4 - // CHECK-CC3-NEXT: COMPLETION: explicit : 4 - // CHECK-CC3-NEXT: COMPLETION: extern : 4 - // CHECK-CC3-NEXT: COMPLETION: float : 4 - // CHECK-CC3-NEXT: COMPLETION: friend : 4 - // CHECK-CC3-NEXT: COMPLETION: inline : 4 - // CHECK-CC3-NEXT: COMPLETION: int : 4 - // CHECK-CC3-NEXT: COMPLETION: long : 4 - // CHECK-CC3-NEXT: COMPLETION: mutable : 4 - // CHECK-CC3-NEXT: COMPLETION: operator : 4 - // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : private: - // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : protected: - // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : public: - // CHECK-CC3-NEXT: COMPLETION: short : 4 - // CHECK-CC3-NEXT: COMPLETION: signed : 4 - // CHECK-CC3-NEXT: COMPLETION: static : 4 - // CHECK-CC3-NEXT: COMPLETION: struct : 4 - // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : template<<#parameters#>> - // CHECK-CC3-NEXT: COMPLETION: typedef : 4 - // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : typename <#qualified-id#> - // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : typeof(<#expression-or-type#>) - // CHECK-CC3-NEXT: COMPLETION: union : 4 - // CHECK-CC3-NEXT: COMPLETION: unsigned : 4 - // CHECK-CC3-NEXT: COMPLETION: Pattern : 4 : using <#qualified-id#>; - // CHECK-CC3-NEXT: COMPLETION: virtual : 4 - // CHECK-CC3-NEXT: COMPLETION: void : 4 - // CHECK-CC3-NEXT: COMPLETION: volatile : 4 - // CHECK-CC3-NEXT: COMPLETION: wchar_t : 4 + // CHECK-CC3: COMPLETION: bool + // CHECK-CC3-NEXT: COMPLETION: char + // CHECK-CC3-NEXT: COMPLETION: class + // CHECK-CC3-NEXT: COMPLETION: const + // CHECK-CC3-NEXT: COMPLETION: double + // CHECK-CC3-NEXT: COMPLETION: enum + // CHECK-CC3-NEXT: COMPLETION: explicit + // CHECK-CC3-NEXT: COMPLETION: extern + // CHECK-CC3-NEXT: COMPLETION: float + // CHECK-CC3-NEXT: COMPLETION: friend + // CHECK-CC3-NEXT: COMPLETION: inline + // CHECK-CC3-NEXT: COMPLETION: int + // CHECK-CC3-NEXT: COMPLETION: long + // CHECK-CC3-NEXT: COMPLETION: mutable + // CHECK-CC3-NEXT: COMPLETION: operator + // CHECK-CC3-NEXT: COMPLETION: Pattern : private: + // CHECK-CC3-NEXT: COMPLETION: Pattern : protected: + // CHECK-CC3-NEXT: COMPLETION: Pattern : public: + // CHECK-CC3-NEXT: COMPLETION: short + // CHECK-CC3-NEXT: COMPLETION: signed + // CHECK-CC3-NEXT: COMPLETION: static + // CHECK-CC3-NEXT: COMPLETION: struct + // CHECK-CC3-NEXT: COMPLETION: Pattern : template<<#parameters#>> + // CHECK-CC3-NEXT: COMPLETION: typedef + // CHECK-CC3-NEXT: COMPLETION: Pattern : typename <#qualified-id#> + // CHECK-CC3-NEXT: COMPLETION: Pattern : typeof(<#expression-or-type#>) + // CHECK-CC3-NEXT: COMPLETION: union + // CHECK-CC3-NEXT: COMPLETION: unsigned + // CHECK-CC3-NEXT: COMPLETION: Pattern : using <#qualified-id#>; + // CHECK-CC3-NEXT: COMPLETION: virtual + // CHECK-CC3-NEXT: COMPLETION: void + // CHECK-CC3-NEXT: COMPLETION: volatile + // CHECK-CC3-NEXT: COMPLETION: wchar_t + // CHECK-CC3-NEXT: COMPLETION: X : X + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s - // CHECK-CC4: COMPLETION: y : 0 : [#int#]y - // CHECK-CC4-NEXT: COMPLETION: foo : 2 : [#void#]foo() - // CHECK-CC4-NEXT: COMPLETION: t : 2 : t - // CHECK-CC4-NEXT: COMPLETION: TYPEDEF : 2 : TYPEDEF - // CHECK-CC4-NEXT: COMPLETION: X : 2 : X - // CHECK-CC4-NEXT: COMPLETION: z : 2 : [#void#]z(<#int#>) - // CHECK-CC4-NEXT: COMPLETION: bool : 3 - // CHECK-CC4-NEXT: COMPLETION: char : 3 - // CHECK-CC4-NEXT: COMPLETION: class : 3 - // CHECK-CC4-NEXT: COMPLETION: const : 3 - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : const_cast<<#type-id#>>(<#expression#>) - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : delete <#expression#> - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : delete[] <#expression#> - // CHECK-CC4-NEXT: COMPLETION: double : 3 - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : dynamic_cast<<#type-id#>>(<#expression#>) - // CHECK-CC4-NEXT: COMPLETION: enum : 3 - // CHECK-CC4-NEXT: COMPLETION: false : 3 - // CHECK-CC4-NEXT: COMPLETION: float : 3 - // CHECK-CC4-NEXT: COMPLETION: int : 3 - // CHECK-CC4-NEXT: COMPLETION: long : 3 - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : new <#type-id#>(<#expressions#>) - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : new <#type-id#>[<#size#>](<#expressions#>) - // CHECK-CC4-NEXT: COMPLETION: operator : 3 - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : reinterpret_cast<<#type-id#>>(<#expression#>) - // CHECK-CC4-NEXT: COMPLETION: short : 3 - // CHECK-CC4-NEXT: COMPLETION: signed : 3 - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : sizeof(<#expression-or-type#>) - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : static_cast<<#type-id#>>(<#expression#>) - // CHECK-CC4-NEXT: COMPLETION: struct : 3 - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : throw <#expression#> - // CHECK-CC4-NEXT: COMPLETION: true : 3 - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : typeid(<#expression-or-type#>) - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : typename <#qualified-id#> - // CHECK-CC4-NEXT: COMPLETION: Pattern : 3 : typeof(<#expression-or-type#>) - // CHECK-CC4-NEXT: COMPLETION: union : 3 - // CHECK-CC4-NEXT: COMPLETION: unsigned : 3 - // CHECK-CC4-NEXT: COMPLETION: void : 3 - // CHECK-CC4-NEXT: COMPLETION: volatile : 3 - // CHECK-CC4-NEXT: COMPLETION: wchar_t : 3 + // CHECK-CC4: COMPLETION: bool + // CHECK-CC4-NEXT: COMPLETION: char + // CHECK-CC4-NEXT: COMPLETION: class + // CHECK-CC4-NEXT: COMPLETION: const + // CHECK-CC4-NEXT: COMPLETION: Pattern : const_cast<<#type-id#>>(<#expression#>) + // CHECK-CC4-NEXT: COMPLETION: Pattern : delete <#expression#> + // CHECK-CC4-NEXT: COMPLETION: Pattern : delete[] <#expression#> + // CHECK-CC4-NEXT: COMPLETION: double + // CHECK-CC4-NEXT: COMPLETION: Pattern : dynamic_cast<<#type-id#>>(<#expression#>) + // CHECK-CC4-NEXT: COMPLETION: enum + // CHECK-CC4-NEXT: COMPLETION: false + // CHECK-CC4-NEXT: COMPLETION: float + // CHECK-CC4-NEXT: COMPLETION: foo : [#void#]foo() + // CHECK-CC4-NEXT: COMPLETION: int + // CHECK-CC4-NEXT: COMPLETION: long + // CHECK-CC4-NEXT: COMPLETION: Pattern : new <#type-id#>(<#expressions#>) + // CHECK-CC4-NEXT: COMPLETION: Pattern : new <#type-id#>[<#size#>](<#expressions#>) + // CHECK-CC4-NEXT: COMPLETION: operator + // CHECK-CC4-NEXT: COMPLETION: Pattern : reinterpret_cast<<#type-id#>>(<#expression#>) + // CHECK-CC4-NEXT: COMPLETION: short + // CHECK-CC4-NEXT: COMPLETION: signed + // CHECK-CC4-NEXT: COMPLETION: Pattern : sizeof(<#expression-or-type#>) + // CHECK-CC4-NEXT: COMPLETION: Pattern : static_cast<<#type-id#>>(<#expression#>) + // CHECK-CC4-NEXT: COMPLETION: struct + // CHECK-CC4-NEXT: COMPLETION: t : t + // CHECK-CC4-NEXT: COMPLETION: Pattern : throw <#expression#> + // CHECK-CC4-NEXT: COMPLETION: true + // CHECK-CC4-NEXT: COMPLETION: TYPEDEF : TYPEDEF + // CHECK-CC4-NEXT: COMPLETION: Pattern : typeid(<#expression-or-type#>) + // CHECK-CC4-NEXT: COMPLETION: Pattern : typename <#qualified-id#> + // CHECK-CC4-NEXT: COMPLETION: Pattern : typeof(<#expression-or-type#>) + // CHECK-CC4-NEXT: COMPLETION: union + // CHECK-CC4-NEXT: COMPLETION: unsigned + // CHECK-CC4-NEXT: COMPLETION: void + // CHECK-CC4-NEXT: COMPLETION: volatile + // CHECK-CC4-NEXT: COMPLETION: wchar_t + // CHECK-CC4-NEXT: COMPLETION: X : X + // CHECK-CC4-NEXT: COMPLETION: y : [#int#]y + // CHECK-CC4-NEXT: COMPLETION: z : [#void#]z(<#int#>) diff --git a/test/CodeCompletion/tag.c b/test/CodeCompletion/tag.c index 554d38100b..6ad2988066 100644 --- a/test/CodeCompletion/tag.c +++ b/test/CodeCompletion/tag.c @@ -8,5 +8,5 @@ void test() { enum X { x }; enum // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:9:7 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: X : 0 - // CHECK-CC1: Y : 2 + // CHECK-CC1: X + // CHECK-CC1: Y diff --git a/test/CodeCompletion/tag.cpp b/test/CodeCompletion/tag.cpp index 17fb0140a0..03fc0fda2e 100644 --- a/test/CodeCompletion/tag.cpp +++ b/test/CodeCompletion/tag.cpp @@ -16,10 +16,12 @@ namespace N { void test() { class // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:17:10 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: Y : 2 - // CHECK-CC1: Z : 2 - // CHECK-CC1: A : 4 - // CHECK-CC1: X : 4 - // CHECK-CC1: Y : 4 - // CHECK-CC1: M : 9 : M:: - // CHECK-CC1: N : 9 : N:: + // FIXME: the redundant Y is really annoying... it needs qualification to + // actually be useful. Here, it just looks redundant :( + // CHECK-CC1: A + // CHECK-CC1: M : M:: + // CHECK-CC1: N : N:: + // CHECK-CC1: X + // CHECK-CC1: Y + // CHECK-CC1: Y + // CHECK-CC1: Z diff --git a/test/CodeCompletion/truncation.c b/test/CodeCompletion/truncation.c index c770635418..134139d78b 100644 --- a/test/CodeCompletion/truncation.c +++ b/test/CodeCompletion/truncation.c @@ -3,9 +3,9 @@ struct // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s.h:4:8 -o - %s | FileCheck -check-prefix=CC1 %s -// CHECK-CC1: X : 1 -// CHECK-CC1-NEXT: Y : 1 +// CHECK-CC1: X +// CHECK-CC1-NEXT: Y // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:3:8 -o - %s | FileCheck -check-prefix=CC2 %s -// CHECK-CC2: X : 1 -// CHECK-CC2: Xa : 1 -// CHECK-CC2: Y : 1 +// CHECK-CC2: X +// CHECK-CC2: Xa +// CHECK-CC2: Y diff --git a/test/CodeCompletion/using-namespace.cpp b/test/CodeCompletion/using-namespace.cpp index f8f31d8c1a..eb1c2bd50e 100644 --- a/test/CodeCompletion/using-namespace.cpp +++ b/test/CodeCompletion/using-namespace.cpp @@ -13,8 +13,8 @@ namespace N2 { void foo() { using namespace // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:14:20 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: I1 : 2 - // CHECK-CC1: I4 : 2 - // CHECK-CC1: I5 : 2 - // CHECK-CC1: N2 : 4 - // CHECK-CC1-NEXT: N4 : 4 + // CHECK-CC1: I1 + // CHECK-CC1: I4 + // CHECK-CC1: I5 + // CHECK-CC1: N2 + // CHECK-CC1-NEXT: N4 diff --git a/test/CodeCompletion/using.cpp b/test/CodeCompletion/using.cpp index ba4c9ce507..b84aa26be9 100644 --- a/test/CodeCompletion/using.cpp +++ b/test/CodeCompletion/using.cpp @@ -15,10 +15,10 @@ namespace N2 { using // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:16:10 %s -o - | FileCheck -check-prefix=CC1 %s - // CHECK-CC1: I1 : 2 - // CHECK-CC1: I4 : 2 - // CHECK-CC1: I5 : 2 - // CHECK-CC1: N2 : 4 - // CHECK-CC1: N3 : 4 - // CHECK-CC1-NEXT: N4 : 4 + // CHECK-CC1: I1 + // CHECK-CC1: I4 + // CHECK-CC1: I5 + // CHECK-CC1: N2 + // CHECK-CC1: N3 + // CHECK-CC1-NEXT: N4 diff --git a/test/Index/code-completion.cpp b/test/Index/code-completion.cpp index 55d068a166..7fd4376735 100644 --- a/test/Index/code-completion.cpp +++ b/test/Index/code-completion.cpp @@ -34,20 +34,20 @@ void test_overloaded() { } // CHECK-MEMBER: FieldDecl:{ResultType double}{TypedText member} +// CHECK-MEMBER: FieldDecl:{ResultType int}{Text X::}{TypedText member} +// CHECK-MEMBER: FieldDecl:{ResultType float}{Text Y::}{TypedText member} // CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} -// CHECK-MEMBER: EnumConstantDecl:{ResultType enum X::E}{Informative E::}{TypedText Val1} -// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} -// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )} -// CHECK-MEMBER: FunctionDecl:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )} // CHECK-MEMBER: FunctionDecl:{ResultType int}{TypedText operator int}{LeftParen (}{RightParen )}{Informative const} // CHECK-MEMBER: FunctionDecl:{ResultType struct Z &}{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )} -// CHECK-MEMBER: FieldDecl:{ResultType int}{Text X::}{TypedText member} -// CHECK-MEMBER: FieldDecl:{ResultType float}{Text Y::}{TypedText member} // CHECK-MEMBER: FunctionDecl:{ResultType struct X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )} // CHECK-MEMBER: FunctionDecl:{ResultType struct Y &}{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )} +// CHECK-MEMBER: EnumConstantDecl:{ResultType enum X::E}{Informative E::}{TypedText Val1} // CHECK-MEMBER: StructDecl:{TypedText X}{Text ::} // CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::} // CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::} +// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} +// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )} +// CHECK-MEMBER: FunctionDecl:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )} // CHECK-OVERLOAD: NotImplemented:{ResultType int &}{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )} // CHECK-OVERLOAD: NotImplemented:{ResultType float &}{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )} diff --git a/test/Index/complete-at-directives.m b/test/Index/complete-at-directives.m index 6db47d20eb..1d0a471dbb 100644 --- a/test/Index/complete-at-directives.m +++ b/test/Index/complete-at-directives.m @@ -29,21 +29,21 @@ // CHECK-CC4: NotImplemented:{TypedText @implementation}{HorizontalSpace }{Placeholder class} // CHECK-CC4: NotImplemented:{TypedText @interface}{HorizontalSpace }{Placeholder class} // CHECK-CC4: NotImplemented:{TypedText @protocol}{HorizontalSpace }{Placeholder protocol} +// CHECK-CC4: NotImplemented:{TypedText _Bool} // CHECK-CC4: TypedefDecl:{TypedText Class} // CHECK-CC4: TypedefDecl:{TypedText id} // CHECK-CC4: TypedefDecl:{TypedText SEL} -// CHECK-CC4: NotImplemented:{TypedText _Bool} // RUN: c-index-test -code-completion-at=%s:3:1 %s | FileCheck -check-prefix=CHECK-CC5 %s // CHECK-CC5: {TypedText @end} // CHECK-CC5: {TypedText @optional} // CHECK-CC5: {TypedText @property} // CHECK-CC5: {TypedText @required} +// CHECK-CC5: NotImplemented:{TypedText _Bool} // CHECK-CC5: TypedefDecl:{TypedText Class} // CHECK-CC5: TypedefDecl:{TypedText id} // CHECK-CC5: ObjCInterfaceDecl:{TypedText MyClass} // CHECK-CC5: TypedefDecl:{TypedText SEL} -// CHECK-CC5: NotImplemented:{TypedText _Bool} // RUN: c-index-test -code-completion-at=%s:2:23 %s | FileCheck -check-prefix=CHECK-CC6 %s // CHECK-CC6: NotImplemented:{TypedText package} diff --git a/test/Index/complete-at-exprstmt.m b/test/Index/complete-at-exprstmt.m index f66f611819..4a2f1527f9 100644 --- a/test/Index/complete-at-exprstmt.m +++ b/test/Index/complete-at-exprstmt.m @@ -21,16 +21,16 @@ // CHECK-CC2: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )} // CHECK-CC2: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )} // RUN: c-index-test -code-completion-at=%s:9:3 %s | FileCheck -check-prefix=CHECK-CC3 %s -// CHECK-CC3: NotImplemented:{ResultType SEL}{TypedText _cmd} -// CHECK-CC3: ParmDecl:{ResultType int}{TypedText arg} -// CHECK-CC3: NotImplemented:{ResultType MyClass *}{TypedText self} +// CHECK-CC3: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )} +// CHECK-CC3: NotImplemented:{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )} +// CHECK-CC3: NotImplemented:{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )} // CHECK-CC3: NotImplemented:{TypedText @synchronized}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }} // CHECK-CC3: NotImplemented:{TypedText @throw}{HorizontalSpace }{Placeholder expression}{SemiColon ;} // CHECK-CC3: NotImplemented:{TypedText @try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }} +// CHECK-CC3: NotImplemented:{ResultType SEL}{TypedText _cmd} +// CHECK-CC3: ParmDecl:{ResultType int}{TypedText arg} // CHECK-CC3: TypedefDecl:{TypedText Class} // CHECK-CC3: TypedefDecl:{TypedText id} // CHECK-CC3: ObjCInterfaceDecl:{TypedText MyClass} // CHECK-CC3: TypedefDecl:{TypedText SEL} -// CHECK-CC3: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )} -// CHECK-CC3: NotImplemented:{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )} -// CHECK-CC3: NotImplemented:{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )} +// CHECK-CC3: NotImplemented:{ResultType MyClass *}{TypedText self} diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m index 79ced32b3b..096ed24c22 100644 --- a/test/Index/complete-objc-message.m +++ b/test/Index/complete-objc-message.m @@ -142,7 +142,6 @@ void f(Ellipsis *e) { // CHECK-CC9: ObjCInstanceMethodDecl:{ResultType int}{Informative Method:}{Informative Arg1:}{TypedText OtherArg:}{Placeholder (id)obj} // RUN: c-index-test -code-completion-at=%s:61:11 %s | FileCheck -check-prefix=CHECK-CCA %s // CHECK-CCA: {ResultType SEL}{TypedText _cmd} -// CHECK-CCA: {ResultType Class}{TypedText self} // CHECK-CCA: TypedefDecl:{TypedText Class} // CHECK-CCA: ObjCInterfaceDecl:{TypedText Foo} // CHECK-CCA: FunctionDecl:{ResultType void}{TypedText func}{LeftParen (}{RightParen )} @@ -150,6 +149,7 @@ void f(Ellipsis *e) { // CHECK-CCA: ObjCInterfaceDecl:{TypedText MyClass} // CHECK-CCA: ObjCInterfaceDecl:{TypedText MySubClass} // CHECK-CCA: TypedefDecl:{TypedText SEL} +// CHECK-CCA: {ResultType Class}{TypedText self} // CHECK-CCA: {TypedText super} // RUN: c-index-test -code-completion-at=%s:103:6 %s | FileCheck -check-prefix=CHECK-CCB %s // CHECK-CCB: ObjCInstanceMethodDecl:{ResultType int}{TypedText Method:}{Placeholder (int)i}{Placeholder , ...} -- 2.40.0