aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-30 01:49:25 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-30 01:49:25 +0000
commit5ac3bdb2cb0113b640c54f01468d21985c08b252 (patch)
treebac20bc124f09bca7acac2cc7955392c66fa3edb /lib/Parse/ParseDecl.cpp
parent4c6a22610146e0046602060745a51548d565ab0e (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105128 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 76da13500a..5d52d8b58c 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/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()) {