Only prove macros as code-completion results when we're in a case

statement or for ordinary names. This means that we won't show macros
when completing, e.g., member expressions such as "p->".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100555 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2010-04-06 20:02:15 +00:00
Родитель 2aefcb2e8b
Коммит 2f880e47ca
2 изменённых файлов: 1 добавлений и 23 удалений

Просмотреть файл

@ -2077,10 +2077,6 @@ void Sema::CodeCompleteMemberReferenceExpr(Scope *S, ExprTy *BaseE,
Results.ExitScope();
// Add macros
if (CodeCompleter->includeMacros())
AddMacroResults(PP, Results);
// Hand off the results found for code completion.
HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
}
@ -2115,8 +2111,6 @@ void Sema::CodeCompleteTag(Scope *S, unsigned TagSpec) {
CodeCompletionDeclConsumer Consumer(Results, CurContext);
LookupVisibleDecls(S, LookupTagName, Consumer);
if (CodeCompleter->includeMacros())
AddMacroResults(PP, Results);
HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
}
@ -2194,7 +2188,7 @@ void Sema::CodeCompleteCase(Scope *S) {
CurContext, 0, false);
}
Results.ExitScope();
if (CodeCompleter->includeMacros())
AddMacroResults(PP, Results);
HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
@ -2309,8 +2303,6 @@ void Sema::CodeCompleteQualifiedId(Scope *S, const CXXScopeSpec &SS,
if (!Results.empty() && NNS->isDependent())
Results.AddResult("template");
if (CodeCompleter->includeMacros())
AddMacroResults(PP, Results);
HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
}
@ -2331,8 +2323,6 @@ void Sema::CodeCompleteUsing(Scope *S) {
LookupVisibleDecls(S, LookupOrdinaryName, Consumer);
Results.ExitScope();
if (CodeCompleter->includeMacros())
AddMacroResults(PP, Results);
HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
}
@ -2347,8 +2337,6 @@ void Sema::CodeCompleteUsingDirective(Scope *S) {
CodeCompletionDeclConsumer Consumer(Results, CurContext);
LookupVisibleDecls(S, LookupOrdinaryName, Consumer);
Results.ExitScope();
if (CodeCompleter->includeMacros())
AddMacroResults(PP, Results);
HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
}
@ -2383,8 +2371,6 @@ void Sema::CodeCompleteNamespaceDecl(Scope *S) {
Results.ExitScope();
}
if (CodeCompleter->includeMacros())
AddMacroResults(PP, Results);
HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
}
@ -2396,8 +2382,6 @@ void Sema::CodeCompleteNamespaceAliasDecl(Scope *S) {
ResultBuilder Results(*this, &ResultBuilder::IsNamespaceOrAlias);
CodeCompletionDeclConsumer Consumer(Results, CurContext);
LookupVisibleDecls(S, LookupOrdinaryName, Consumer);
if (CodeCompleter->includeMacros())
AddMacroResults(PP, Results);
HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
}
@ -2424,8 +2408,6 @@ void Sema::CodeCompleteOperatorName(Scope *S) {
AddTypeSpecifierResults(getLangOptions(), Results);
Results.ExitScope();
if (CodeCompleter->includeMacros())
AddMacroResults(PP, Results);
HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
}

Просмотреть файл

@ -19,11 +19,7 @@ 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: BAR(<#X#>, <#Y#>)
// CC1: color
// CC1: FOO
// CC1: IDENTITY(<#X#>)
// CC1: WIBBLE
// CC1: x
// CC1: y
// CC1: z