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
This commit is contained in:
Douglas Gregor
2009-09-22 23:22:24 +00:00
parent 5bf52697b0
commit 2b3ee156fc
3 changed files with 18 additions and 6 deletions

View File

@@ -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;
}