diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-01-13 21:24:21 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-01-13 21:24:21 +0000 |
| commit | f193416359009ebb6a9a4c197f42519b9b25f015 (patch) | |
| tree | 3357111214e36dad605018d65562ee72a9b0b768 /clang/lib/Parse | |
| parent | 6f0bf8262231388a9fdcfed33ae3f470ba458d89 (diff) | |
| download | bcm5719-llvm-f193416359009ebb6a9a4c197f42519b9b25f015.tar.gz bcm5719-llvm-f193416359009ebb6a9a4c197f42519b9b25f015.zip | |
Whenever completing ordinary names for an Objective-C source, also
provide completions for @ keywords. Previously, we only provided
@-completions after an @ was actually typed, which is useful but
probably not the common case.
Also, make sure a few Objective-C 2.0 completions only show up when
Objective-C 2.0 support is enabled (the default).
llvm-svn: 93354
Diffstat (limited to 'clang/lib/Parse')
| -rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/Parse/Parser.cpp | 4 |
3 files changed, 14 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 66a69574433..b5ba8acafc8 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -835,7 +835,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, : Action::CCC_Template; else if (DSContext == DSC_class) CCC = Action::CCC_Class; - + else if (ObjCImpDecl) + CCC = Action::CCC_ObjCImplementation; + Actions.CodeCompleteOrdinaryName(CurScope, CCC); ConsumeToken(); } diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index eb58ebc0e1a..fa3c35683ee 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -334,6 +334,14 @@ void Parser::ParseObjCInterfaceDeclList(DeclPtrTy interfaceDecl, if (Tok.is(tok::eof)) break; + // Code completion within an Objective-C interface. + if (Tok.is(tok::code_completion)) { + Actions.CodeCompleteOrdinaryName(CurScope, + ObjCImpDecl? Action::CCC_ObjCImplementation + : Action::CCC_ObjCInterface); + ConsumeToken(); + } + // If we don't have an @ directive, parse it as a function definition. if (Tok.isNot(tok::at)) { // The code below does not consume '}'s because it is afraid of eating the diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 2a94339c797..0aecac97574 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -455,7 +455,9 @@ Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration(CXX0XAttributeList Attr) SingleDecl = ParseObjCMethodDefinition(); break; case tok::code_completion: - Actions.CodeCompleteOrdinaryName(CurScope, Action::CCC_Namespace); + Actions.CodeCompleteOrdinaryName(CurScope, + ObjCImpDecl? Action::CCC_ObjCImplementation + : Action::CCC_Namespace); ConsumeToken(); return ParseExternalDeclaration(Attr); case tok::kw_using: |

