diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-09-22 23:22:24 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-09-22 23:22:24 +0000 |
commit | 3e7253f155e1e40542a6815689adef5abc65b17b (patch) | |
tree | b7bd838d289022135043ce0cf33e0fbbb90a147f /lib/Sema/SemaCodeComplete.cpp | |
parent | 0563c2677cfc20c9450342ddc53aa96971671c71 (diff) |
When code-completion finds a declaration only because it is usable as
the start of a nested-name-specifier, add the "::" after the
nested-name-specifier to the code-completion string.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82587 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index f57480e13e..f0be3c68b8 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -313,6 +313,11 @@ void ResultBuilder::MaybeAddResult(Result R, DeclContext *CurContext) { R.QualifierIsInformative = false; } + // If the filter is for nested-name-specifiers, then this result starts a + // nested-name-specifier. + if (Filter == &ResultBuilder::IsNestedNameSpecifier) + R.StartsNestedNameSpecifier = true; + // Insert this result into the set of results and into the current shadow // map. SMap.insert(std::make_pair(R.Declaration->getDeclName(), @@ -849,11 +854,13 @@ CodeCompleteConsumer::Result::CreateCodeCompletionString(Sema &S) { return Result; } - if (Qualifier) { + if (Qualifier || StartsNestedNameSpecifier) { CodeCompletionString *Result = new CodeCompletionString; AddQualifierToCompletionString(Result, Qualifier, QualifierIsInformative, S.Context); Result->AddTextChunk(ND->getNameAsString().c_str()); + if (StartsNestedNameSpecifier) + Result->AddTextChunk("::"); return Result; } |