jkorous-apple created this revision.
Herald added a subscriber: eraman.

It seems like constructor code completion was intentionally disabled ages ago 
in this commit (and refactored later):

commit 33224e61bfca370850abae89bbd415a4dabe07fa
Author: Douglas Gregor <dgre...@apple.com>
Date:   Fri Sep 18 17:42:29 2009 +0000

  For code completion in C++ member access expressions and tag names,
  look into the current scope for anything that could start a
  nested-names-specifier. These results are ranked worse than any of the
  results actually found in the lexical scope.
  
  Perform a little more pruning of the result set, eliminating
  constructors, __va_list_tag, and any duplication of declarations in
  the result set. For the latter, implemented
  NamespaceDecl::getCanonicalDecl.

I am not sure if there is actually anything relying on the fact that 
constructors are not included in code completion results. The only test that 
seems affected is probably not really concerned about these.

rdar://problem/19190970


https://reviews.llvm.org/D39730

Files:
  lib/Sema/SemaCodeComplete.cpp
  test/Index/complete-cxx-inline-methods.cpp


Index: test/Index/complete-cxx-inline-methods.cpp
===================================================================
--- test/Index/complete-cxx-inline-methods.cpp
+++ test/Index/complete-cxx-inline-methods.cpp
@@ -26,6 +26,8 @@
 // RUN: c-index-test -code-completion-at=%s:4:9 -std=c++98 %s | FileCheck %s
 // RUN: c-index-test -code-completion-at=%s:13:7 -std=c++98 %s | FileCheck %s
 // CHECK:      CXXMethod:{ResultType MyCls::Vec &}{TypedText 
operator=}{LeftParen (}{Placeholder const MyCls::Vec &}{RightParen )} (79)
+// CHECK-NEXT: CXXConstructor:{TypedText Vec}{LeftParen (}{RightParen )} (34)
+// CHECK-NEXT: CXXConstructor:{TypedText Vec}{LeftParen (}{Placeholder const 
MyCls::Vec &}{RightParen )} (34)
 // CHECK-NEXT: StructDecl:{TypedText Vec}{Text ::} (75)
 // CHECK-NEXT: FieldDecl:{ResultType int}{TypedText x} (35)
 // CHECK-NEXT: FieldDecl:{ResultType int}{TypedText y} (35)
Index: lib/Sema/SemaCodeComplete.cpp
===================================================================
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -975,10 +975,6 @@
   bool AsNestedNameSpecifier = false;
   if (!isInterestingDecl(R.Declaration, AsNestedNameSpecifier))
     return;
-  
-  // C++ constructors are never found by name lookup.
-  if (isa<CXXConstructorDecl>(R.Declaration))
-    return;
 
   if (Hiding && CheckHiddenResult(R, CurContext, Hiding))
     return;


Index: test/Index/complete-cxx-inline-methods.cpp
===================================================================
--- test/Index/complete-cxx-inline-methods.cpp
+++ test/Index/complete-cxx-inline-methods.cpp
@@ -26,6 +26,8 @@
 // RUN: c-index-test -code-completion-at=%s:4:9 -std=c++98 %s | FileCheck %s
 // RUN: c-index-test -code-completion-at=%s:13:7 -std=c++98 %s | FileCheck %s
 // CHECK:      CXXMethod:{ResultType MyCls::Vec &}{TypedText operator=}{LeftParen (}{Placeholder const MyCls::Vec &}{RightParen )} (79)
+// CHECK-NEXT: CXXConstructor:{TypedText Vec}{LeftParen (}{RightParen )} (34)
+// CHECK-NEXT: CXXConstructor:{TypedText Vec}{LeftParen (}{Placeholder const MyCls::Vec &}{RightParen )} (34)
 // CHECK-NEXT: StructDecl:{TypedText Vec}{Text ::} (75)
 // CHECK-NEXT: FieldDecl:{ResultType int}{TypedText x} (35)
 // CHECK-NEXT: FieldDecl:{ResultType int}{TypedText y} (35)
Index: lib/Sema/SemaCodeComplete.cpp
===================================================================
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -975,10 +975,6 @@
   bool AsNestedNameSpecifier = false;
   if (!isInterestingDecl(R.Declaration, AsNestedNameSpecifier))
     return;
-  
-  // C++ constructors are never found by name lookup.
-  if (isa<CXXConstructorDecl>(R.Declaration))
-    return;
 
   if (Hiding && CheckHiddenResult(R, CurContext, Hiding))
     return;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to