Implement code completion for tags, e.g., code completion after "enum"

will provide the names of various enumerations currently
visible. Introduced filtering of code-completion results when we build
the result set, so that we can identify just the kinds of declarations
we want.

This implementation is incomplete for C++, since we don't consider
that the token after the tag keyword could start a
nested-name-specifier. 

llvm-svn: 82222
This commit is contained in:
Douglas Gregor
2009-09-18 15:37:17 +00:00
parent bd1af01fcd
commit f45b0cf389
9 changed files with 277 additions and 28 deletions

View File

@@ -34,6 +34,35 @@ void Sema::CodeCompleteMemberReferenceExpr(Scope *S, ExprTy *BaseE,
CodeCompleter->CodeCompleteMemberReferenceExpr(S, BaseType, IsArrow);
}
void Sema::CodeCompleteTag(Scope *S, unsigned TagSpec) {
if (!CodeCompleter)
return;
TagDecl::TagKind TK;
switch ((DeclSpec::TST)TagSpec) {
case DeclSpec::TST_enum:
TK = TagDecl::TK_enum;
break;
case DeclSpec::TST_union:
TK = TagDecl::TK_union;
break;
case DeclSpec::TST_struct:
TK = TagDecl::TK_struct;
break;
case DeclSpec::TST_class:
TK = TagDecl::TK_class;
break;
default:
assert(false && "Unknown type specifier kind in CodeCompleteTag");
return;
}
CodeCompleter->CodeCompleteTag(S, TK);
}
void Sema::CodeCompleteQualifiedId(Scope *S, const CXXScopeSpec &SS,
bool EnteringContext) {
if (!SS.getScopeRep() || !CodeCompleter)