kadircet updated this revision to Diff 170628.
kadircet added a comment.
Herald added a subscriber: arphaman.
- Use new types
- Rebase
Repository:
rC Clang
https://reviews.llvm.org/D53191
Files:
include/clang/Sema/CodeCompleteConsumer.h
lib/Frontend/ASTUnit.cpp
lib/Sema/CodeCompleteConsumer.cpp
lib/Sema/SemaCodeComplete.cpp
tools/libclang/CIndexCodeCompletion.cpp
Index: tools/libclang/CIndexCodeCompletion.cpp
===================================================================
--- tools/libclang/CIndexCodeCompletion.cpp
+++ tools/libclang/CIndexCodeCompletion.cpp
@@ -487,7 +487,8 @@
contexts = CXCompletionContext_Namespace;
break;
}
- case CodeCompletionContext::CCC_PotentiallyQualifiedName: {
+ case CodeCompletionContext::CCC_PotentiallyQualifiedNewName:
+ case CodeCompletionContext::CCC_PotentiallyQualifiedExistingName: {
contexts = CXCompletionContext_NestedNameSpecifier;
break;
}
@@ -539,7 +540,8 @@
case CodeCompletionContext::CCC_Other:
case CodeCompletionContext::CCC_ObjCInterface:
case CodeCompletionContext::CCC_ObjCImplementation:
- case CodeCompletionContext::CCC_Name:
+ case CodeCompletionContext::CCC_NewName:
+ case CodeCompletionContext::CCC_ExistingName:
case CodeCompletionContext::CCC_MacroName:
case CodeCompletionContext::CCC_PreprocessorExpression:
case CodeCompletionContext::CCC_PreprocessorDirective:
Index: lib/Sema/SemaCodeComplete.cpp
===================================================================
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -3748,11 +3748,12 @@
bool AllowNonIdentifiers,
bool AllowNestedNameSpecifiers) {
typedef CodeCompletionResult Result;
- ResultBuilder Results(*this, CodeCompleter->getAllocator(),
- CodeCompleter->getCodeCompletionTUInfo(),
- AllowNestedNameSpecifiers
- ? CodeCompletionContext::CCC_PotentiallyQualifiedName
- : CodeCompletionContext::CCC_Name);
+ ResultBuilder Results(
+ *this, CodeCompleter->getAllocator(),
+ CodeCompleter->getCodeCompletionTUInfo(),
+ AllowNestedNameSpecifiers
+ ? CodeCompletionContext::CCC_PotentiallyQualifiedExistingName
+ : CodeCompletionContext::CCC_NewName);
Results.EnterNewScope();
// Type qualifiers can come after names.
@@ -4833,7 +4834,7 @@
// it can be useful for global code completion which have information about
// contexts/symbols that are not in the AST.
if (SS.isInvalid()) {
- CodeCompletionContext CC(CodeCompletionContext::CCC_Name);
+ CodeCompletionContext CC(CodeCompletionContext::CCC_ExistingName);
CC.setCXXScopeSpecifier(SS);
HandleCodeCompleteResults(this, CodeCompleter, CC, nullptr, 0);
return;
@@ -4849,9 +4850,10 @@
if (!isDependentScopeSpecifier(SS) && RequireCompleteDeclContext(SS, Ctx))
return;
- ResultBuilder Results(*this, CodeCompleter->getAllocator(),
- CodeCompleter->getCodeCompletionTUInfo(),
- CodeCompletionContext::CCC_Name);
+ ResultBuilder Results(
+ *this, CodeCompleter->getAllocator(),
+ CodeCompleter->getCodeCompletionTUInfo(),
+ CodeCompletionContext::CCC_PotentiallyQualifiedExistingName);
Results.EnterNewScope();
// The "template" keyword can follow "::" in the grammar, but only
@@ -4889,10 +4891,11 @@
if (!CodeCompleter)
return;
- ResultBuilder Results(*this, CodeCompleter->getAllocator(),
- CodeCompleter->getCodeCompletionTUInfo(),
- CodeCompletionContext::CCC_PotentiallyQualifiedName,
- &ResultBuilder::IsNestedNameSpecifier);
+ ResultBuilder Results(
+ *this, CodeCompleter->getAllocator(),
+ CodeCompleter->getCodeCompletionTUInfo(),
+ CodeCompletionContext::CCC_PotentiallyQualifiedExistingName,
+ &ResultBuilder::IsNestedNameSpecifier);
Results.EnterNewScope();
// If we aren't in class scope, we could see the "namespace" keyword.
@@ -5041,9 +5044,10 @@
if (!Constructor)
return;
- ResultBuilder Results(*this, CodeCompleter->getAllocator(),
- CodeCompleter->getCodeCompletionTUInfo(),
- CodeCompletionContext::CCC_PotentiallyQualifiedName);
+ ResultBuilder Results(
+ *this, CodeCompleter->getAllocator(),
+ CodeCompleter->getCodeCompletionTUInfo(),
+ CodeCompletionContext::CCC_PotentiallyQualifiedExistingName);
Results.EnterNewScope();
// Fill in any already-initialized fields or base classes.
Index: lib/Sema/CodeCompleteConsumer.cpp
===================================================================
--- lib/Sema/CodeCompleteConsumer.cpp
+++ lib/Sema/CodeCompleteConsumer.cpp
@@ -49,6 +49,8 @@
case CCC_Expression:
case CCC_ObjCMessageReceiver:
case CCC_ParenthesizedExpression:
+ case CCC_PotentiallyQualifiedExistingName:
+ case CCC_ExistingName:
return true;
case CCC_TopLevel:
@@ -65,8 +67,8 @@
case CCC_ObjCProtocolName:
case CCC_Namespace:
case CCC_Type:
- case CCC_Name:
- case CCC_PotentiallyQualifiedName:
+ case CCC_PotentiallyQualifiedNewName:
+ case CCC_NewName:
case CCC_MacroName:
case CCC_MacroNameUse:
case CCC_PreprocessorExpression:
@@ -128,10 +130,14 @@
return "Namespace";
case CCKind::CCC_Type:
return "Type";
- case CCKind::CCC_Name:
- return "Name";
- case CCKind::CCC_PotentiallyQualifiedName:
- return "PotentiallyQualifiedName";
+ case CCKind::CCC_NewName:
+ return "NewName";
+ case CCKind::CCC_ExistingName:
+ return "ExistingName";
+ case CCKind::CCC_PotentiallyQualifiedNewName:
+ return "PotentiallyQualifiedNewName";
+ case CCKind::CCC_PotentiallyQualifiedExistingName:
+ return "CCC_PotentiallyQualifiedExistingName";
case CCKind::CCC_MacroName:
return "MacroName";
case CCKind::CCC_MacroNameUse:
Index: lib/Frontend/ASTUnit.cpp
===================================================================
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -282,7 +282,7 @@
/// Determine the set of code-completion contexts in which this
/// declaration should be shown.
-static unsigned getDeclShowContexts(const NamedDecl *ND,
+static uint64_t getDeclShowContexts(const NamedDecl *ND,
const LangOptions &LangOpts,
bool &IsNestedNameSpecifier) {
IsNestedNameSpecifier = false;
@@ -436,14 +436,15 @@
| (1LL << CodeCompletionContext::CCC_UnionTag)
| (1LL << CodeCompletionContext::CCC_ClassOrStructTag)
| (1LL << CodeCompletionContext::CCC_Type)
- | (1LL << CodeCompletionContext::CCC_PotentiallyQualifiedName)
+ | (1LL << CodeCompletionContext::CCC_PotentiallyQualifiedExistingName)
+ | (1LL << CodeCompletionContext::CCC_PotentiallyQualifiedNewName)
| (1LL << CodeCompletionContext::CCC_ParenthesizedExpression);
if (isa<NamespaceDecl>(R.Declaration) ||
isa<NamespaceAliasDecl>(R.Declaration))
NNSContexts |= (1LL << CodeCompletionContext::CCC_Namespace);
- if (unsigned RemainingContexts
+ if (uint64_t RemainingContexts
= NNSContexts & ~CachedResult.ShowInContexts) {
// If there any contexts where this completion can be a
// nested-name-specifier but isn't already an option, create a
@@ -1951,8 +1952,8 @@
case CodeCompletionContext::CCC_ObjCPropertyAccess:
case CodeCompletionContext::CCC_Namespace:
case CodeCompletionContext::CCC_Type:
- case CodeCompletionContext::CCC_Name:
- case CodeCompletionContext::CCC_PotentiallyQualifiedName:
+ case CodeCompletionContext::CCC_PotentiallyQualifiedExistingName:
+ case CodeCompletionContext::CCC_ExistingName:
case CodeCompletionContext::CCC_ParenthesizedExpression:
case CodeCompletionContext::CCC_ObjCInterfaceName:
break;
@@ -1977,6 +1978,8 @@
case CodeCompletionContext::CCC_ObjCClassMessage:
case CodeCompletionContext::CCC_ObjCCategoryName:
case CodeCompletionContext::CCC_IncludedFile:
+ case CodeCompletionContext::CCC_PotentiallyQualifiedNewName:
+ case CodeCompletionContext::CCC_NewName:
// We're looking for nothing, or we're looking for names that cannot
// be hidden.
return;
Index: include/clang/Sema/CodeCompleteConsumer.h
===================================================================
--- include/clang/Sema/CodeCompleteConsumer.h
+++ include/clang/Sema/CodeCompleteConsumer.h
@@ -272,11 +272,18 @@
CCC_Type,
/// Code completion occurred where a new name is expected.
- CCC_Name,
+ CCC_NewName,
+
+ /// Code completion occurred where an existing name is expected.
+ CCC_ExistingName,
/// Code completion occurred where a new name is expected and a
/// qualified name is permissible.
- CCC_PotentiallyQualifiedName,
+ CCC_PotentiallyQualifiedNewName,
+
+ /// Code completion occurred where an existing name is expected and a
+ /// qualified name is permissible.
+ CCC_PotentiallyQualifiedExistingName,
/// Code completion occurred where an macro is being defined.
CCC_MacroName,
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits