diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-08-23 21:17:50 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-08-23 21:17:50 +0000 |
commit | fb6294123b9de1605adae69d85cb4fddf81a9bc5 (patch) | |
tree | 83ddffeaeb795f15b25461b11520744c28bebdaa /lib/Parse/ParseStmt.cpp | |
parent | 45f7c78ea33e0b1b1575ca6e6f7a094be5f77e32 (diff) |
Introduce a code-completion hook for the Objective-C collection
argument in a for-each statement (e.g., "for (id x in <blah>)"), which
restricts the expression completions provided to Objective-C types (or
class types in C++).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111843 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index de39a924b5..de81c7797a 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -1023,6 +1023,11 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) { Actions.ActOnForEachDeclStmt(DG); // ObjC: for (id x in expr) ConsumeToken(); // consume 'in' + + if (Tok.is(tok::code_completion)) { + Actions.CodeCompleteObjCForCollection(getCurScope(), DG); + ConsumeCodeCompletionToken(); + } Collection = ParseExpression(); } else { Diag(Tok, diag::err_expected_semi_for); @@ -1039,6 +1044,11 @@ Parser::OwningStmtResult Parser::ParseForStatement(AttributeList *Attr) { ConsumeToken(); } else if ((ForEach = isTokIdentifier_in())) { ConsumeToken(); // consume 'in' + + if (Tok.is(tok::code_completion)) { + Actions.CodeCompleteObjCForCollection(getCurScope(), DeclGroupPtrTy()); + ConsumeCodeCompletionToken(); + } Collection = ParseExpression(); } else { if (!Value.isInvalid()) Diag(Tok, diag::err_expected_semi_for); |