From 7aa6b229fe38bd9577223f21ad0ce57c23258ae4 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sun, 30 May 2010 01:49:25 +0000 Subject: Teach code completion to adjust its completion priorities based on the type that we expect to see at a given point in the grammar, e.g., when initializing a variable, returning a result, or calling a function. We don't prune the candidate set at all, just adjust priorities to favor things that should type-check, using an ultra-simplified type system. llvm-svn: 105128 --- clang/lib/Parse/ParseDecl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'clang/lib/Parse/ParseDecl.cpp') diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 76da13500a4..5d52d8b58c6 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -556,6 +556,13 @@ Parser::DeclPtrTy Parser::ParseDeclarationAfterDeclarator(Declarator &D, Actions.ActOnCXXEnterDeclInitializer(CurScope, ThisDecl); } + if (Tok.is(tok::code_completion)) { + Actions.CodeCompleteInitializer(CurScope, ThisDecl); + ConsumeCodeCompletionToken(); + SkipUntil(tok::comma, true, true); + return ThisDecl; + } + OwningExprResult Init(ParseInitializer()); if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { -- cgit v1.2.3