summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.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
commit7aa6b229fe38bd9577223f21ad0ce57c23258ae4 (patch)
treefc599ed41df4720f7bc3bbdf2def407a8fb976ef /clang/lib/Parse/ParseExpr.cpp
parent0e15c9aef62a835c6d111dee723d22fbba5398b8 (diff)
downloadbcm5719-llvm-7aa6b229fe38bd9577223f21ad0ce57c23258ae4.tar.gz
bcm5719-llvm-7aa6b229fe38bd9577223f21ad0ce57c23258ae4.zip
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
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r--clang/lib/Parse/ParseExpr.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 0059a9a0fe4..7be1a1994e6 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -343,6 +343,14 @@ Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, prec::Level MinPrec) {
}
}
+ // Code completion for the right-hand side of an assignment expression
+ // goes through a special hook that takes the left-hand side into account.
+ if (Tok.is(tok::code_completion) && NextTokPrec == prec::Assignment) {
+ Actions.CodeCompleteAssignmentRHS(CurScope, LHS.get());
+ ConsumeCodeCompletionToken();
+ return ExprError();
+ }
+
// Parse another leaf here for the RHS of the operator.
// ParseCastExpression works here because all RHS expressions in C have it
// as a prefix, at least. However, in C++, an assignment-expression could
OpenPOWER on IntegriCloud