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 | 2b3ee156fc516ba18752b5e05b29d63b7df1ce1a (patch) | |
tree | b8c3c6dc88528ebecc1db3988cd80db92c76235e /clang/lib/Sema/SemaCodeComplete.cpp | |
parent | 5bf52697b079b4b7c9db9a38c202788743d7264d (diff) | |
download | bcm5719-llvm-2b3ee156fc516ba18752b5e05b29d63b7df1ce1a.tar.gz bcm5719-llvm-2b3ee156fc516ba18752b5e05b29d63b7df1ce1a.zip |
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.
llvm-svn: 82587
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index f57480e13e8..f0be3c68b83 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/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; } |