summaryrefslogtreecommitdiffstats
path: root/clang/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
commit5e35d591882da37368cd1bfa300e731473b08854 (patch)
tree18d09a390b45006e4d2804c382dc5a096a592871 /clang/lib/Parse/ParseExpr.cpp
parentc7cf42d80bd5e364127760ccfb8402e3feb5f306 (diff)
downloadbcm5719-llvm-5e35d591882da37368cd1bfa300e731473b08854.tar.gz
bcm5719-llvm-5e35d591882da37368cd1bfa300e731473b08854.zip
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. llvm-svn: 113904
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 1c2b343141d..4ee924543a6 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/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));
OpenPOWER on IntegriCloud