diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-09-23 23:01:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-09-23 23:01:17 +0000 |
commit | 0ac41389a4401daafa350d42d65ad4eb90ed61f0 (patch) | |
tree | 25bc879f7e9db70e277fbb6a965fd73e20a5d11e /clang/lib/Frontend/ASTUnit.cpp | |
parent | bd57e0ce3dd39b5e658298000adf7446b9796487 (diff) | |
download | bcm5719-llvm-0ac41389a4401daafa350d42d65ad4eb90ed61f0.tar.gz bcm5719-llvm-0ac41389a4401daafa350d42d65ad4eb90ed61f0.zip |
Synchronize globally-cached code completion results with the results
provided when the optimization is disabled. In particular, split
the completion context CCC_Other into two contexts: CCC_Other, which
means that it's an undisclosed context for which any other results are
unwelcome, and CCC_Recovery, which is used in recovery cases.
Since we're now using the completion context within the completion
results builder, make sure that it's always set to something.
Fixes <rdar://problem/8470644>.
llvm-svn: 114704
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 4980f2dcc3f..b6c4eaac5ff 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -142,7 +142,7 @@ static unsigned getDeclShowContexts(NamedDecl *ND, if (LangOpts.CPlusPlus) IsNestedNameSpecifier = true; - } else if (isa<ClassTemplateDecl>(ND) || isa<TemplateTemplateParmDecl>(ND)) + } else if (isa<ClassTemplateDecl>(ND)) IsNestedNameSpecifier = true; } else if (isa<ValueDecl>(ND) || isa<FunctionTemplateDecl>(ND)) { // Values can appear in these contexts. @@ -1523,7 +1523,8 @@ namespace { | (1 << (CodeCompletionContext::CCC_ObjCMessageReceiver - 1)) | (1 << (CodeCompletionContext::CCC_MemberAccess - 1)) | (1 << (CodeCompletionContext::CCC_ObjCProtocolName - 1)) - | (1 << (CodeCompletionContext::CCC_ParenthesizedExpression - 1)); + | (1 << (CodeCompletionContext::CCC_ParenthesizedExpression - 1)) + | (1 << (CodeCompletionContext::CCC_Recovery - 1)); if (AST.getASTContext().getLangOptions().CPlusPlus) NormalContexts |= (1 << (CodeCompletionContext::CCC_EnumTag - 1)) @@ -1553,7 +1554,7 @@ void CalculateHiddenNames(const CodeCompletionContext &Context, llvm::StringSet<> &HiddenNames) { bool OnlyTagNames = false; switch (Context.getKind()) { - case CodeCompletionContext::CCC_Other: + case CodeCompletionContext::CCC_Recovery: case CodeCompletionContext::CCC_TopLevel: case CodeCompletionContext::CCC_ObjCInterface: case CodeCompletionContext::CCC_ObjCImplementation: @@ -1584,6 +1585,7 @@ void CalculateHiddenNames(const CodeCompletionContext &Context, case CodeCompletionContext::CCC_NaturalLanguage: case CodeCompletionContext::CCC_SelectorName: case CodeCompletionContext::CCC_TypeQualifiers: + case CodeCompletionContext::CCC_Other: // We're looking for nothing, or we're looking for names that cannot // be hidden. return; @@ -1628,7 +1630,7 @@ void AugmentedCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &S, // Merge the results we were given with the results we cached. bool AddedResult = false; unsigned InContexts - = (Context.getKind() == CodeCompletionContext::CCC_Other? NormalContexts + = (Context.getKind() == CodeCompletionContext::CCC_Recovery? NormalContexts : (1 << (Context.getKind() - 1))); // Contains the set of names that are hidden by "local" completion results. |