aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseExpr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-14 23:59:36 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-14 23:59:36 +0000
commit0268810a46780144a2d5fb5a017c938d1199189c (patch)
tree6e06d1b58bdb7854ca6481a14459e3ef339e93bf /lib/Parse/ParseExpr.cpp
parent6c52c7850bccb6991470668429a1e1edf01b0873 (diff)
Introduce a new code-completion context for a parenthesized
expression, e.g., after the '(' that could also be a type cast. Here, we provide types as code-completion results in C/Objective-C (C++ already had them), although we wouldn't in a normal expression context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExpr.cpp')
-rw-r--r--lib/Parse/ParseExpr.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 1c2b343141..4ee924543a 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -1452,6 +1452,14 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
bool isAmbiguousTypeId;
CastTy = ParsedType();
+ if (Tok.is(tok::code_completion)) {
+ Actions.CodeCompleteOrdinaryName(getCurScope(),
+ ExprType >= CompoundLiteral? Sema::PCC_ParenthesizedExpression
+ : Sema::PCC_Expression);
+ ConsumeCodeCompletionToken();
+ return ExprError();
+ }
+
if (ExprType >= CompoundStmt && Tok.is(tok::l_brace)) {
Diag(Tok, diag::ext_gnu_statement_expr);
StmtResult Stmt(ParseCompoundStatement(0, true));