зеркало из https://github.com/microsoft/clang-1.git
Teach code completion not to include out-of-line declarations and
definitions in its results. The original declarations will be visible wherever they are declared. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118484 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
46728793a2
Коммит
9b0ba87a5e
|
@ -505,6 +505,14 @@ bool ResultBuilder::isInterestingDecl(NamedDecl *ND,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip out-of-line declarations and definitions.
|
||||||
|
// NOTE: Unless it's an Objective-C property, method, or ivar, where
|
||||||
|
// the contexts can be messy.
|
||||||
|
if (!ND->getDeclContext()->Equals(ND->getLexicalDeclContext()) &&
|
||||||
|
!(isa<ObjCPropertyDecl>(ND) || isa<ObjCIvarDecl>(ND) ||
|
||||||
|
isa<ObjCMethodDecl>(ND)))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (Filter == &ResultBuilder::IsNestedNameSpecifier ||
|
if (Filter == &ResultBuilder::IsNestedNameSpecifier ||
|
||||||
((isa<NamespaceDecl>(ND) || isa<NamespaceAliasDecl>(ND)) &&
|
((isa<NamespaceDecl>(ND) || isa<NamespaceAliasDecl>(ND)) &&
|
||||||
Filter != &ResultBuilder::IsNamespace &&
|
Filter != &ResultBuilder::IsNamespace &&
|
||||||
|
@ -5724,7 +5732,6 @@ void Sema::CodeCompleteNaturalLanguage() {
|
||||||
void Sema::GatherGlobalCodeCompletions(
|
void Sema::GatherGlobalCodeCompletions(
|
||||||
llvm::SmallVectorImpl<CodeCompletionResult> &Results) {
|
llvm::SmallVectorImpl<CodeCompletionResult> &Results) {
|
||||||
ResultBuilder Builder(*this, CodeCompletionContext::CCC_Recovery);
|
ResultBuilder Builder(*this, CodeCompletionContext::CCC_Recovery);
|
||||||
|
|
||||||
if (!CodeCompleter || CodeCompleter->includeGlobals()) {
|
if (!CodeCompleter || CodeCompleter->includeGlobals()) {
|
||||||
CodeCompletionDeclConsumer Consumer(Builder,
|
CodeCompletionDeclConsumer Consumer(Builder,
|
||||||
Context.getTranslationUnitDecl());
|
Context.getTranslationUnitDecl());
|
||||||
|
|
|
@ -11,17 +11,19 @@ template<typename T>
|
||||||
class vector {
|
class vector {
|
||||||
public:
|
public:
|
||||||
vector(const T &, unsigned n);
|
vector(const T &, unsigned n);
|
||||||
|
|
||||||
template<typename InputIterator>
|
template<typename InputIterator>
|
||||||
vector(InputIterator first, InputIterator last);
|
vector(InputIterator first, InputIterator last);
|
||||||
|
void push_back(const T&);
|
||||||
};
|
};
|
||||||
|
template<typename T> void vector<T>::push_back(const T&) { }
|
||||||
void f() {
|
void f() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RUN: c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
// RUN: c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||||
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:20:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||||
|
// CHECK-CC1: NotImplemented:{TypedText operator} (40)
|
||||||
|
// CHECK-CC1-NOT: push_back
|
||||||
// CHECK-CC1: ClassDecl:{TypedText string} (50)
|
// CHECK-CC1: ClassDecl:{TypedText string} (50)
|
||||||
// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{RightParen )} (50)
|
// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{RightParen )} (50)
|
||||||
// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{Placeholder const char *}{RightParen )} (50)
|
// CHECK-CC1: CXXConstructor:{TypedText string}{LeftParen (}{Placeholder const char *}{RightParen )} (50)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче