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 | 52779fb71795534d0447f6f4d4a6f6a7b09c4639 (patch) | |
tree | ebe30da1c1eb36ba1ff4e70e688ff2711efc11df /lib/Frontend/ASTUnit.cpp | |
parent | b17cc9e904c277b97cc4d57227122acd8d46ed36 (diff) |
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>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index 4980f2dcc3..b6c4eaac5f 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/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. |