Re: [PATCH] D17820: Clang Code Completion Filtering

2016-07-25 Thread Bianca-Cristina Cristescu via cfe-commits
CrisCristescu updated this revision to Diff 65401.
CrisCristescu marked 3 inline comments as done.
CrisCristescu added a comment.

Addressing some sugesstions.


Repository:
  rL LLVM

https://reviews.llvm.org/D17820

Files:
  include/clang/Lex/Preprocessor.h
  include/clang/Sema/CodeCompleteConsumer.h
  lib/Lex/Lexer.cpp
  lib/Lex/Preprocessor.cpp
  lib/Sema/CodeCompleteConsumer.cpp
  test/CodeCompletion/filter-function-name.cpp
  test/CodeCompletion/filter-member-access.cpp
  test/CodeCompletion/filter-namespace.cpp
  test/CodeCompletion/filter-ordinary-name.cpp
  test/CodeCompletion/objc-message.mm
  test/Index/complete-method-decls.m
  test/Index/complete-objc-message-id.m
  test/Index/complete-objc-message.m
  test/Index/complete-recovery.m
  test/Index/complete-super.m

Index: test/Index/complete-super.m
===
--- test/Index/complete-super.m
+++ test/Index/complete-super.m
@@ -60,16 +60,16 @@
 // RUN: c-index-test -code-completion-at=%s:20:16 %s | FileCheck -check-prefix=CHECK-ADD-TO %s
 // CHECK-ADD-TO: ObjCInstanceMethodDecl:{ResultType void}{Informative add:}{TypedText to:}{Placeholder b} (20)
 
-// RUN: c-index-test -code-completion-at=%s:24:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:24:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // CHECK-SELECTOR-FIRST: ObjCClassMethodDecl:{ResultType void}{Informative select:}{TypedText first:}{Placeholder a}{HorizontalSpace  }{Text second:}{Placeholder b} (20)
 
 // Check "super" completion at the third identifier
 // RUN: c-index-test -code-completion-at=%s:24:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
 // CHECK-SELECTOR-SECOND: ObjCClassMethodDecl:{ResultType void}{Informative select:}{Informative first:}{TypedText second:}{Placeholder b} (20)
 
 // Check "super" completion with missing '['.
 // RUN: c-index-test -code-completion-at=%s:25:10 %s | FileCheck -check-prefix=CHECK-SELECTOR-SELECTOR %s
-// RUN: c-index-test -code-completion-at=%s:25:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:25:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // RUN: c-index-test -code-completion-at=%s:25:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
 
 // Check "super" completion for a method declared in a category.
Index: test/Index/complete-recovery.m
===
--- test/Index/complete-recovery.m
+++ test/Index/complete-recovery.m
@@ -26,7 +26,7 @@
 // Test case for fix committed in r145441.
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s -fms-compatibility | FileCheck -check-prefix=CHECK-CC1 %s
 
-// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:24 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:25 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
 // CHECK-CC2: NotImplemented:{TypedText _Bool}
 // CHECK-CC2: VarDecl:{ResultType A *}{TypedText a}
Index: test/Index/complete-objc-message.m
===
--- test/Index/complete-objc-message.m
+++ test/Index/complete-objc-message.m
@@ -218,13 +218,13 @@
 // CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl
 // CHECK-CC2-NEXT: Container is complete
 // CHECK-CC2-NEXT: Container USR: c:objc(cs)Foo
-// RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: c-index-test -code-completion-at=%s:61:17 %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)}
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
-// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// RUN: c-index-test -code-completion-at=%s:65:17 %s | FileCheck -check-prefix=CHECK-CC4 %s
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace  }{TypedText second:}{Placeholder (id)}
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
-// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// RUN: c-index-test -code-completion-at=%s:74:10 %s | FileCheck -check-prefix=CHECK-CC5 %s
 // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace  }{TypedText second:}{Placeholder (id)}
 // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
 // RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s
@@ -311,7 +311,7 @@
 // CHECK-CCI: ObjCInstanceMethodDecl:{Res

Re: [PATCH] D17820: Clang Code Completion Filtering

2016-07-25 Thread Bianca-Cristina Cristescu via cfe-commits
CrisCristescu updated this revision to Diff 65403.
CrisCristescu marked an inline comment as done.
CrisCristescu added a comment.

PP CodeCompletionII initialisation.


Repository:
  rL LLVM

https://reviews.llvm.org/D17820

Files:
  include/clang/Lex/Preprocessor.h
  include/clang/Sema/CodeCompleteConsumer.h
  lib/Lex/Lexer.cpp
  lib/Lex/Preprocessor.cpp
  lib/Sema/CodeCompleteConsumer.cpp
  test/CodeCompletion/filter-function-name.cpp
  test/CodeCompletion/filter-member-access.cpp
  test/CodeCompletion/filter-namespace.cpp
  test/CodeCompletion/filter-ordinary-name.cpp
  test/CodeCompletion/objc-message.mm
  test/Index/complete-method-decls.m
  test/Index/complete-objc-message-id.m
  test/Index/complete-objc-message.m
  test/Index/complete-recovery.m
  test/Index/complete-super.m

Index: test/Index/complete-super.m
===
--- test/Index/complete-super.m
+++ test/Index/complete-super.m
@@ -60,16 +60,16 @@
 // RUN: c-index-test -code-completion-at=%s:20:16 %s | FileCheck -check-prefix=CHECK-ADD-TO %s
 // CHECK-ADD-TO: ObjCInstanceMethodDecl:{ResultType void}{Informative add:}{TypedText to:}{Placeholder b} (20)
 
-// RUN: c-index-test -code-completion-at=%s:24:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:24:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // CHECK-SELECTOR-FIRST: ObjCClassMethodDecl:{ResultType void}{Informative select:}{TypedText first:}{Placeholder a}{HorizontalSpace  }{Text second:}{Placeholder b} (20)
 
 // Check "super" completion at the third identifier
 // RUN: c-index-test -code-completion-at=%s:24:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
 // CHECK-SELECTOR-SECOND: ObjCClassMethodDecl:{ResultType void}{Informative select:}{Informative first:}{TypedText second:}{Placeholder b} (20)
 
 // Check "super" completion with missing '['.
 // RUN: c-index-test -code-completion-at=%s:25:10 %s | FileCheck -check-prefix=CHECK-SELECTOR-SELECTOR %s
-// RUN: c-index-test -code-completion-at=%s:25:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:25:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // RUN: c-index-test -code-completion-at=%s:25:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
 
 // Check "super" completion for a method declared in a category.
Index: test/Index/complete-recovery.m
===
--- test/Index/complete-recovery.m
+++ test/Index/complete-recovery.m
@@ -26,7 +26,7 @@
 // Test case for fix committed in r145441.
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s -fms-compatibility | FileCheck -check-prefix=CHECK-CC1 %s
 
-// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:24 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:25 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
 // CHECK-CC2: NotImplemented:{TypedText _Bool}
 // CHECK-CC2: VarDecl:{ResultType A *}{TypedText a}
Index: test/Index/complete-objc-message.m
===
--- test/Index/complete-objc-message.m
+++ test/Index/complete-objc-message.m
@@ -218,13 +218,13 @@
 // CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl
 // CHECK-CC2-NEXT: Container is complete
 // CHECK-CC2-NEXT: Container USR: c:objc(cs)Foo
-// RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: c-index-test -code-completion-at=%s:61:17 %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)}
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
-// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// RUN: c-index-test -code-completion-at=%s:65:17 %s | FileCheck -check-prefix=CHECK-CC4 %s
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace  }{TypedText second:}{Placeholder (id)}
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
-// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// RUN: c-index-test -code-completion-at=%s:74:10 %s | FileCheck -check-prefix=CHECK-CC5 %s
 // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace  }{TypedText second:}{Placeholder (id)}
 // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
 // RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s
@@ -311,7 +311,7 @@
 // CHECK-CCI: ObjCInstanceMethodDe

Re: [PATCH] D17820: Clang Code Completion Filtering

2016-07-26 Thread Bianca-Cristina Cristescu via cfe-commits
CrisCristescu updated this revision to Diff 65508.
CrisCristescu marked an inline comment as done.
CrisCristescu added a comment.

Some more cosmetics.


Repository:
  rL LLVM

https://reviews.llvm.org/D17820

Files:
  include/clang/Lex/Preprocessor.h
  include/clang/Sema/CodeCompleteConsumer.h
  lib/Lex/Lexer.cpp
  lib/Lex/Preprocessor.cpp
  lib/Sema/CodeCompleteConsumer.cpp
  test/CodeCompletion/filter-function-name.cpp
  test/CodeCompletion/filter-member-access.cpp
  test/CodeCompletion/filter-namespace.cpp
  test/CodeCompletion/filter-ordinary-name.cpp
  test/CodeCompletion/objc-message.mm
  test/Index/complete-method-decls.m
  test/Index/complete-objc-message-id.m
  test/Index/complete-objc-message.m
  test/Index/complete-recovery.m
  test/Index/complete-super.m

Index: test/Index/complete-super.m
===
--- test/Index/complete-super.m
+++ test/Index/complete-super.m
@@ -60,16 +60,16 @@
 // RUN: c-index-test -code-completion-at=%s:20:16 %s | FileCheck -check-prefix=CHECK-ADD-TO %s
 // CHECK-ADD-TO: ObjCInstanceMethodDecl:{ResultType void}{Informative add:}{TypedText to:}{Placeholder b} (20)
 
-// RUN: c-index-test -code-completion-at=%s:24:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:24:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // CHECK-SELECTOR-FIRST: ObjCClassMethodDecl:{ResultType void}{Informative select:}{TypedText first:}{Placeholder a}{HorizontalSpace  }{Text second:}{Placeholder b} (20)
 
 // Check "super" completion at the third identifier
 // RUN: c-index-test -code-completion-at=%s:24:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
 // CHECK-SELECTOR-SECOND: ObjCClassMethodDecl:{ResultType void}{Informative select:}{Informative first:}{TypedText second:}{Placeholder b} (20)
 
 // Check "super" completion with missing '['.
 // RUN: c-index-test -code-completion-at=%s:25:10 %s | FileCheck -check-prefix=CHECK-SELECTOR-SELECTOR %s
-// RUN: c-index-test -code-completion-at=%s:25:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:25:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // RUN: c-index-test -code-completion-at=%s:25:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
 
 // Check "super" completion for a method declared in a category.
Index: test/Index/complete-recovery.m
===
--- test/Index/complete-recovery.m
+++ test/Index/complete-recovery.m
@@ -26,7 +26,7 @@
 // Test case for fix committed in r145441.
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s -fms-compatibility | FileCheck -check-prefix=CHECK-CC1 %s
 
-// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:24 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:25 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
 // CHECK-CC2: NotImplemented:{TypedText _Bool}
 // CHECK-CC2: VarDecl:{ResultType A *}{TypedText a}
Index: test/Index/complete-objc-message.m
===
--- test/Index/complete-objc-message.m
+++ test/Index/complete-objc-message.m
@@ -218,13 +218,13 @@
 // CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl
 // CHECK-CC2-NEXT: Container is complete
 // CHECK-CC2-NEXT: Container USR: c:objc(cs)Foo
-// RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: c-index-test -code-completion-at=%s:61:17 %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)}
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
-// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// RUN: c-index-test -code-completion-at=%s:65:17 %s | FileCheck -check-prefix=CHECK-CC4 %s
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace  }{TypedText second:}{Placeholder (id)}
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
-// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// RUN: c-index-test -code-completion-at=%s:74:10 %s | FileCheck -check-prefix=CHECK-CC5 %s
 // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace  }{TypedText second:}{Placeholder (id)}
 // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
 // RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s
@@ -311,7 +311,7 @@
 // CHECK-CCI: ObjCInstanceMethodDecl:{ResultType 

Re: [PATCH] D17820: Clang Code Completion Filtering

2016-07-26 Thread Bianca-Cristina Cristescu via cfe-commits
CrisCristescu updated this revision to Diff 65528.
CrisCristescu added a comment.

Wrong indentation update.


Repository:
  rL LLVM

https://reviews.llvm.org/D17820

Files:
  include/clang/Lex/Preprocessor.h
  include/clang/Sema/CodeCompleteConsumer.h
  lib/Lex/Lexer.cpp
  lib/Lex/Preprocessor.cpp
  lib/Sema/CodeCompleteConsumer.cpp
  test/CodeCompletion/filter-function-name.cpp
  test/CodeCompletion/filter-member-access.cpp
  test/CodeCompletion/filter-namespace.cpp
  test/CodeCompletion/filter-ordinary-name.cpp
  test/CodeCompletion/objc-message.mm
  test/Index/complete-method-decls.m
  test/Index/complete-objc-message-id.m
  test/Index/complete-objc-message.m
  test/Index/complete-recovery.m
  test/Index/complete-super.m

Index: test/Index/complete-super.m
===
--- test/Index/complete-super.m
+++ test/Index/complete-super.m
@@ -60,16 +60,16 @@
 // RUN: c-index-test -code-completion-at=%s:20:16 %s | FileCheck -check-prefix=CHECK-ADD-TO %s
 // CHECK-ADD-TO: ObjCInstanceMethodDecl:{ResultType void}{Informative add:}{TypedText to:}{Placeholder b} (20)
 
-// RUN: c-index-test -code-completion-at=%s:24:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:24:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // CHECK-SELECTOR-FIRST: ObjCClassMethodDecl:{ResultType void}{Informative select:}{TypedText first:}{Placeholder a}{HorizontalSpace  }{Text second:}{Placeholder b} (20)
 
 // Check "super" completion at the third identifier
 // RUN: c-index-test -code-completion-at=%s:24:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
 // CHECK-SELECTOR-SECOND: ObjCClassMethodDecl:{ResultType void}{Informative select:}{Informative first:}{TypedText second:}{Placeholder b} (20)
 
 // Check "super" completion with missing '['.
 // RUN: c-index-test -code-completion-at=%s:25:10 %s | FileCheck -check-prefix=CHECK-SELECTOR-SELECTOR %s
-// RUN: c-index-test -code-completion-at=%s:25:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:25:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // RUN: c-index-test -code-completion-at=%s:25:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
 
 // Check "super" completion for a method declared in a category.
Index: test/Index/complete-recovery.m
===
--- test/Index/complete-recovery.m
+++ test/Index/complete-recovery.m
@@ -26,7 +26,7 @@
 // Test case for fix committed in r145441.
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s -fms-compatibility | FileCheck -check-prefix=CHECK-CC1 %s
 
-// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:24 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:25 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
 // CHECK-CC2: NotImplemented:{TypedText _Bool}
 // CHECK-CC2: VarDecl:{ResultType A *}{TypedText a}
Index: test/Index/complete-objc-message.m
===
--- test/Index/complete-objc-message.m
+++ test/Index/complete-objc-message.m
@@ -218,13 +218,13 @@
 // CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl
 // CHECK-CC2-NEXT: Container is complete
 // CHECK-CC2-NEXT: Container USR: c:objc(cs)Foo
-// RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: c-index-test -code-completion-at=%s:61:17 %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)}
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
-// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// RUN: c-index-test -code-completion-at=%s:65:17 %s | FileCheck -check-prefix=CHECK-CC4 %s
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace  }{TypedText second:}{Placeholder (id)}
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
-// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// RUN: c-index-test -code-completion-at=%s:74:10 %s | FileCheck -check-prefix=CHECK-CC5 %s
 // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace  }{TypedText second:}{Placeholder (id)}
 // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
 // RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s
@@ -311,7 +311,7 @@
 // CHECK-CCI: ObjCInstanceMethodDecl:{ResultType void}{TypedText method1} (37)
 // CHECK-CCI

Re: [PATCH] D17820: Clang Code Completion Filtering

2016-05-04 Thread Bianca-Cristina Cristescu via cfe-commits
CrisCristescu updated this revision to Diff 56115.
CrisCristescu added a comment.

Addresses the previous comments and adds testing for filtering. 
All the tests already in CodeCompletion are testing both the backward 
compatibility and the new functionality itself.


Repository:
  rL LLVM

http://reviews.llvm.org/D17820

Files:
  include/clang/Lex/Preprocessor.h
  include/clang/Sema/CodeCompleteConsumer.h
  lib/Lex/Lexer.cpp
  lib/Lex/Preprocessor.cpp
  lib/Sema/CodeCompleteConsumer.cpp
  test/CodeCompletion/Filtering/filter-function-name.cpp
  test/CodeCompletion/Filtering/filter-member-access.cpp
  test/CodeCompletion/Filtering/filter-namespace.cpp
  test/CodeCompletion/Filtering/filter-ordinary-name.cpp
  test/CodeCompletion/objc-message.mm
  test/Index/complete-method-decls.m
  test/Index/complete-objc-message-id.m
  test/Index/complete-objc-message.m
  test/Index/complete-recovery.m
  test/Index/complete-super.m

Index: test/Index/complete-super.m
===
--- test/Index/complete-super.m
+++ test/Index/complete-super.m
@@ -60,7 +60,7 @@
 // RUN: c-index-test -code-completion-at=%s:20:16 %s | FileCheck -check-prefix=CHECK-ADD-TO %s
 // CHECK-ADD-TO: ObjCInstanceMethodDecl:{ResultType void}{Informative add:}{TypedText to:}{Placeholder b} (20)
 
-// RUN: c-index-test -code-completion-at=%s:24:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:24:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // CHECK-SELECTOR-FIRST: ObjCClassMethodDecl:{ResultType void}{Informative select:}{TypedText first:}{Placeholder a}{HorizontalSpace  }{Text second:}{Placeholder b} (20)
 
 // Check "super" completion at the third identifier
@@ -69,7 +69,7 @@
 
 // Check "super" completion with missing '['.
 // RUN: c-index-test -code-completion-at=%s:25:10 %s | FileCheck -check-prefix=CHECK-SELECTOR-SELECTOR %s
-// RUN: c-index-test -code-completion-at=%s:25:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:25:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // RUN: c-index-test -code-completion-at=%s:25:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
 
 // Check "super" completion for a method declared in a category.
Index: test/Index/complete-recovery.m
===
--- test/Index/complete-recovery.m
+++ test/Index/complete-recovery.m
@@ -26,7 +26,7 @@
 // Test case for fix committed in r145441.
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s -fms-compatibility | FileCheck -check-prefix=CHECK-CC1 %s
 
-// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:24 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:25 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
 // CHECK-CC2: NotImplemented:{TypedText _Bool}
 // CHECK-CC2: VarDecl:{ResultType A *}{TypedText a}
Index: test/Index/complete-objc-message.m
===
--- test/Index/complete-objc-message.m
+++ test/Index/complete-objc-message.m
@@ -218,13 +218,13 @@
 // CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl
 // CHECK-CC2-NEXT: Container is complete
 // CHECK-CC2-NEXT: Container USR: c:objc(cs)Foo
-// RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: c-index-test -code-completion-at=%s:61:17 %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)}
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
-// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// RUN: c-index-test -code-completion-at=%s:65:17 %s | FileCheck -check-prefix=CHECK-CC4 %s
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace  }{TypedText second:}{Placeholder (id)}
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
-// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// RUN: c-index-test -code-completion-at=%s:74:10 %s | FileCheck -check-prefix=CHECK-CC5 %s
 // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace  }{TypedText second:}{Placeholder (id)}
 // CHECK-CC5: ObjCInstanceMethodDecl:{ResultType int}{TypedText MySubInstMethod}
 // RUN: c-index-test -code-completion-at=%s:82:8 %s | FileCheck -check-prefix=CHECK-CC6 %s
@@ -311,7 +311,7 @@
 // CHECK-CCI: ObjCInstanceMethodDecl:{ResultType void}{TypedText method1} (37)
 // CHECK-CCI: ObjCInstanceMethodDecl:{ResultType 

[PATCH] D17820: Clang Code Completion Filtering

2016-03-02 Thread Bianca-Cristina Cristescu via cfe-commits
CrisCristescu created this revision.
CrisCristescu added reviewers: clang-c, benlangmuir, akyrtzi.
CrisCristescu added a subscriber: cfe-commits.
CrisCristescu set the repository for this revision to rL LLVM.
CrisCristescu changed the visibility of this Differential Revision from "Public 
(No Login Required)" to "All Users".

The patch is enabling filtering for code completion.

The stem upon which the filtering is to be done is known at the moment of 
parsing.
A get/set function for the completion stem has been added to the Token class in 
order to save the stem as the identifier of the code_complete token type. Once 
the token has been set, it has to be passed through to the SemaCodeCompleteX 
functions, which subsequently passes it to the HandleCodeCompletionResults and 
which passes it to the PrintingCodeCompleteConsumer::ProcessCodeCompleteResults 
where the actual filtering is happening.


Repository:
  rL LLVM

http://reviews.llvm.org/D17820

Files:
  include/clang/Lex/Token.h
  include/clang/Sema/CodeCompleteConsumer.h
  include/clang/Sema/Sema.h
  lib/Lex/Lexer.cpp
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseExpr.cpp
  lib/Parse/ParseExprCXX.cpp
  lib/Parse/ParseObjc.cpp
  lib/Parse/ParseStmt.cpp
  lib/Parse/Parser.cpp
  lib/Sema/CodeCompleteConsumer.cpp
  lib/Sema/SemaCodeComplete.cpp
  test/CodeCompletion/Filtering/filter-function-name.cpp
  test/CodeCompletion/Filtering/filter-member-access.cpp
  test/CodeCompletion/Filtering/filter-namespace.cpp
  test/CodeCompletion/Filtering/filter-ordinary-name.cpp

Index: test/CodeCompletion/Filtering/filter-ordinary-name.cpp
===
--- /dev/null
+++ test/CodeCompletion/Filtering/filter-ordinary-name.cpp
@@ -0,0 +1,8 @@
+int main() {
+	int myVariableOne;
+	int myVariableTwo;
+	myVar
+	// RUN: %clang_cc1 -code-completion-at=%s:4:10 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+	// CHECK-CC1: COMPLETION: myVariableOne : [#int#]myVariableOne
+	// CHECK-CC1-NEXT: COMPLETION: myVariableTwo : [#int#]myVariableTwo
+}
\ No newline at end of file
Index: test/CodeCompletion/Filtering/filter-namespace.cpp
===
--- /dev/null
+++ test/CodeCompletion/Filtering/filter-namespace.cpp
@@ -0,0 +1,7 @@
+namespace outerspace {
+  namespace innerspace { }
+}
+
+using namespace outerspace::inner
+// RUN: %clang_cc1 -code-completion-at=%s:5:34 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: COMPLETION: innerspace : innerspace
Index: test/CodeCompletion/Filtering/filter-member-access.cpp
===
--- /dev/null
+++ test/CodeCompletion/Filtering/filter-member-access.cpp
@@ -0,0 +1,24 @@
+class MyClass {
+private:
+  int anInteger;
+  double aDouble;
+
+public:
+  MyClass(int i, double d) {
+	anInteger = i;
+	aDouble = d;
+  }	
+  int getInt() { return anInteger; }
+  double getDouble() { return aDouble; }
+  void setInt(int value) { anInteger = value; }
+  void setDouble(double value) { aDouble = value; }
+};
+
+int main() {
+	MyClass* objectMyClass = new MyClass(5, 1.0);
+	objectMyClass->set
+	// RUN: %clang_cc1 -code-completion-at=%s:19:23 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+	// CHECK-CC1: COMPLETION: setDouble : [#void#]setDouble(<#double value#>)
+	// CHECK-CC1-NEXT: COMPLETION: setInt : [#void#]setInt(<#int value#>)
+	return 0;
+}
\ No newline at end of file
Index: test/CodeCompletion/Filtering/filter-function-name.cpp
===
--- /dev/null
+++ test/CodeCompletion/Filtering/filter-function-name.cpp
@@ -0,0 +1,8 @@
+void myFunction();
+
+int main() {
+	myFunc
+	// RUN: %clang_cc1 -code-completion-at=%s:4:11 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+	// CHECK-CC1: COMPLETION: myFunction : [#void#]myFunction()
+}
+
Index: lib/Sema/SemaCodeComplete.cpp
===
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -3065,13 +3065,14 @@
   Results.ExitScope();
 }
 
-static void HandleCodeCompleteResults(Sema *S,
+static void HandleCodeCompleteResults(Token Tok, Sema *S,
   CodeCompleteConsumer *CodeCompleter,
   CodeCompletionContext Context,
   CodeCompletionResult *Results,
   unsigned NumResults) {
-  if (CodeCompleter)
-CodeCompleter->ProcessCodeCompleteResults(*S, Context, Results, NumResults);
+  if (CodeCompleter) {
+CodeCompleter->ProcessCodeCompleteResults(Tok, *S, Context, Results, NumResults);
+  }
 }
 
 static enum CodeCompletionContext::Kind mapCodeCompletionContext(Sema &S, 
@@ -3203,7 +3204,7 @@
   }
 }
 
-void Sema::CodeCompleteModuleImport(SourceLocation ImportLoc, 
+void Sema::CodeCompleteModuleImport(Token Tok, SourceLocation ImportLoc,
 

Re: [PATCH] D17820: Clang Code Completion Filtering

2016-03-23 Thread Bianca-Cristina Cristescu via cfe-commits
CrisCristescu updated this revision to Diff 51404.
CrisCristescu added a comment.

The code_completion token now stores the information, if there is one,
about the identifier that it is lexing.
During the parsing there is a common entry point which is ConsumerToken
where we can set the information necessary for filtering in the Sema
in the case of a code_completion token.
The information is retrieved when doing the actual filtering.

This introduces a change in functionality which means that some tests
had to be modified(6 tests for ObjC) due to the fact that if you press
tab at the end of a word which could be a language specific keyword,
you will get the possible completions of this identifier,
not what could be written after the space. This is in accordance with the
behaviour of IDEs, for instance XCode.
As an example:
const will only give completions for variables like constVar,
and if you have const the you get the possible completions:
const double, const int etc.


Repository:
  rL LLVM

http://reviews.llvm.org/D17820

Files:
  include/clang/Parse/Parser.h
  include/clang/Sema/CodeCompleteConsumer.h
  include/clang/Sema/Sema.h
  lib/Lex/Lexer.cpp
  lib/Sema/CodeCompleteConsumer.cpp
  lib/Sema/Sema.cpp
  test/CodeCompletion/objc-message.mm
  test/Index/complete-method-decls.m
  test/Index/complete-objc-message-id.m
  test/Index/complete-objc-message.m
  test/Index/complete-recovery.m
  test/Index/complete-super.m

Index: test/Index/complete-super.m
===
--- test/Index/complete-super.m
+++ test/Index/complete-super.m
@@ -60,7 +60,7 @@
 // RUN: c-index-test -code-completion-at=%s:20:16 %s | FileCheck -check-prefix=CHECK-ADD-TO %s
 // CHECK-ADD-TO: ObjCInstanceMethodDecl:{ResultType void}{Informative add:}{TypedText to:}{Placeholder b} (20)
 
-// RUN: c-index-test -code-completion-at=%s:24:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:24:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // CHECK-SELECTOR-FIRST: ObjCClassMethodDecl:{ResultType void}{Informative select:}{TypedText first:}{Placeholder a}{HorizontalSpace  }{Text second:}{Placeholder b} (20)
 
 // Check "super" completion at the third identifier
@@ -69,7 +69,7 @@
 
 // Check "super" completion with missing '['.
 // RUN: c-index-test -code-completion-at=%s:25:10 %s | FileCheck -check-prefix=CHECK-SELECTOR-SELECTOR %s
-// RUN: c-index-test -code-completion-at=%s:25:28 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
+// RUN: c-index-test -code-completion-at=%s:25:29 %s | FileCheck -check-prefix=CHECK-SELECTOR-FIRST %s
 // RUN: c-index-test -code-completion-at=%s:25:37 %s | FileCheck -check-prefix=CHECK-SELECTOR-SECOND %s
 
 // Check "super" completion for a method declared in a category.
Index: test/Index/complete-recovery.m
===
--- test/Index/complete-recovery.m
+++ test/Index/complete-recovery.m
@@ -26,7 +26,7 @@
 // Test case for fix committed in r145441.
 // RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:9:20 %s -fms-compatibility | FileCheck -check-prefix=CHECK-CC1 %s
 
-// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:24 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// RUN: env CINDEXTEST_CODE_COMPLETE_PATTERNS=1 c-index-test -code-completion-at=%s:10:25 %s | FileCheck -check-prefix=CHECK-CC2 %s
 // CHECK-CC2: NotImplemented:{ResultType char[]}{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
 // CHECK-CC2: NotImplemented:{TypedText _Bool}
 // CHECK-CC2: VarDecl:{ResultType A *}{TypedText a}
Index: test/Index/complete-objc-message.m
===
--- test/Index/complete-objc-message.m
+++ test/Index/complete-objc-message.m
@@ -218,13 +218,13 @@
 // CHECK-CC2-NEXT: Container Kind: ObjCInterfaceDecl
 // CHECK-CC2-NEXT: Container is complete
 // CHECK-CC2-NEXT: Container USR: c:objc(cs)Foo
-// RUN: c-index-test -code-completion-at=%s:61:16 %s | FileCheck -check-prefix=CHECK-CC3 %s
+// RUN: c-index-test -code-completion-at=%s:61:17 %s | FileCheck -check-prefix=CHECK-CC3 %s
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyClassMethod:}{Placeholder (id)}
 // CHECK-CC3: ObjCClassMethodDecl:{ResultType int}{TypedText MyPrivateMethod}
-// RUN: c-index-test -code-completion-at=%s:65:16 %s | FileCheck -check-prefix=CHECK-CC4 %s
+// RUN: c-index-test -code-completion-at=%s:65:17 %s | FileCheck -check-prefix=CHECK-CC4 %s
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyInstMethod:}{Placeholder (id)}{HorizontalSpace  }{TypedText second:}{Placeholder (id)}
 // CHECK-CC4: ObjCInstanceMethodDecl:{ResultType int}{TypedText MyPrivateInstMethod}
-// RUN: c-index-test -code-completion-at=%s:74:9 %s | FileCheck -check-prefix=CHECK-CC5 %s
+// RUN: c-index-test -code-completion-at=%s:74:10 %s | File

Re: [PATCH] D17820: Clang Code Completion Filtering

2016-03-23 Thread Bianca-Cristina Cristescu via cfe-commits
CrisCristescu added a comment.

For the filtering itself the motivation for not doing it on the client side is 
the following in our use case:

- we do not re-filter on every key stroke, we only filter when the  key is 
pressed i.e there is one completion point;
- we have a PCH which will help with the generation time;
- performance is acceptable with the patch included: less than 1s even when the 
file contains several "heavier" includes such as  or ;
- without the patch if the  key is pressed in the middle of the identifier 
name (i.e setDouble) an error is thrown:

fiter-member-access.cpp:19:17: error: no member named 'set' in 'MyClass'

objectMyClass->set
~  ^
  - and most importantly, we plan to propose another set of patches which would 
do lookup's only on subsets of the DeclContext of the identifier i.e incomplete 
lookup-s in order to reduce the amount of PCH deserializations.


Repository:
  rL LLVM

http://reviews.llvm.org/D17820



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits