зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
0563c2677c
Коммит
3e7253f155
|
@ -173,6 +173,10 @@ public:
|
|||
/// \brief Whether this result was found via lookup into a base class.
|
||||
bool QualifierIsInformative : 1;
|
||||
|
||||
/// \brief Whether this declaration is the beginning of a
|
||||
/// nested-name-specifier and, therefore, should be followed by '::'.
|
||||
bool StartsNestedNameSpecifier : 1;
|
||||
|
||||
/// \brief If the result should have a nested-name-specifier, this is it.
|
||||
/// When \c QualifierIsInformative, the nested-name-specifier is
|
||||
/// informative rather than required.
|
||||
|
@ -183,13 +187,14 @@ public:
|
|||
NestedNameSpecifier *Qualifier = 0,
|
||||
bool QualifierIsInformative = false)
|
||||
: Kind(RK_Declaration), Declaration(Declaration), Rank(Rank),
|
||||
Hidden(false), QualifierIsInformative(QualifierIsInformative),
|
||||
Qualifier(Qualifier) { }
|
||||
Hidden(false), QualifierIsInformative(QualifierIsInformative),
|
||||
StartsNestedNameSpecifier(false), Qualifier(Qualifier) { }
|
||||
|
||||
/// \brief Build a result that refers to a keyword or symbol.
|
||||
Result(const char *Keyword, unsigned Rank)
|
||||
: Kind(RK_Keyword), Keyword(Keyword), Rank(Rank), Hidden(false),
|
||||
QualifierIsInformative(0), Qualifier(0) { }
|
||||
QualifierIsInformative(0), StartsNestedNameSpecifier(false),
|
||||
Qualifier(0) { }
|
||||
|
||||
/// \brief Retrieve the declaration stored in this result.
|
||||
NamedDecl *getDeclaration() const {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,6 @@ namespace N {
|
|||
// CHECK-CC1: A : 4
|
||||
// CHECK-CC1: X : 4
|
||||
// CHECK-CC1: Y : 4
|
||||
// CHECK-CC1: M : 9
|
||||
// CHECK-CC1: N : 9
|
||||
// CHECK-CC1: M : 9 : M::
|
||||
// CHECK-CC1: N : 9 : N::
|
||||
// RUN: true
|
||||
|
|
Загрузка…
Ссылка в новой задаче