diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-09-18 19:03:04 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-09-18 19:03:04 +0000 |
commit | 49f40bd0c9c9de5e74727774fec429b47d36303a (patch) | |
tree | 4ff8ee97f177b7a7b080e1757932437ec6c1702b /lib/Parse/ParseDeclCXX.cpp | |
parent | 2744a063f1d9c475d76c2276f0b4f0998dfc5d09 (diff) |
Introduce four new code-completion hooks for C++:
- after "using", show anything that can be a nested-name-specifier.
- after "using namespace", show any visible namespaces or namespace aliases
- after "namespace", show any namespace definitions in the current scope
- after "namespace identifier = ", show any visible namespaces or
namespace aliases
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82251 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 1b82c06bf8..59a6e6281c 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -47,6 +47,11 @@ Parser::DeclPtrTy Parser::ParseNamespace(unsigned Context, assert(Tok.is(tok::kw_namespace) && "Not a namespace!"); SourceLocation NamespaceLoc = ConsumeToken(); // eat the 'namespace'. + if (Tok.is(tok::code_completion)) { + Actions.CodeCompleteNamespaceDecl(CurScope); + ConsumeToken(); + } + SourceLocation IdentLoc; IdentifierInfo *Ident = 0; @@ -115,6 +120,11 @@ Parser::DeclPtrTy Parser::ParseNamespaceAlias(SourceLocation NamespaceLoc, ConsumeToken(); // eat the '='. + if (Tok.is(tok::code_completion)) { + Actions.CodeCompleteNamespaceAliasDecl(CurScope); + ConsumeToken(); + } + CXXScopeSpec SS; // Parse (optional) nested-name-specifier. ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, false); @@ -188,6 +198,11 @@ Parser::DeclPtrTy Parser::ParseUsingDirectiveOrDeclaration(unsigned Context, // Eat 'using'. SourceLocation UsingLoc = ConsumeToken(); + if (Tok.is(tok::code_completion)) { + Actions.CodeCompleteUsing(CurScope); + ConsumeToken(); + } + if (Tok.is(tok::kw_namespace)) // Next token after 'using' is 'namespace' so it must be using-directive return ParseUsingDirective(Context, UsingLoc, DeclEnd); @@ -214,6 +229,11 @@ Parser::DeclPtrTy Parser::ParseUsingDirective(unsigned Context, // Eat 'namespace'. SourceLocation NamespcLoc = ConsumeToken(); + if (Tok.is(tok::code_completion)) { + Actions.CodeCompleteUsingDirective(CurScope); + ConsumeToken(); + } + CXXScopeSpec SS; // Parse (optional) nested-name-specifier. ParseOptionalCXXScopeSpecifier(SS, /*ObjectType=*/0, false); |