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 | 68762e78527ad2b185938db4b29bf6729e0997d7 (patch) | |
tree | da23ceb21e5b41a1a390b11c8cffd222e78ebc81 /clang/lib/Parse/ParseStmt.cpp | |
parent | 66427b1fcfaa4f2b6f5af33b1c35389f4d95bfdd (diff) | |
download | bcm5719-llvm-68762e78527ad2b185938db4b29bf6729e0997d7.tar.gz bcm5719-llvm-68762e78527ad2b185938db4b29bf6729e0997d7.zip |
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++).
llvm-svn: 111843
Diffstat (limited to 'clang/lib/Parse/ParseStmt.cpp')
-rw-r--r-- | clang/lib/Parse/ParseStmt.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index de39a924b51..de81c7797a0 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/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); |