]> granicus.if.org Git - clang/commit
Initial implementation of a code-completion interface in Clang. In
authorDouglas Gregor <dgregor@apple.com>
Thu, 17 Sep 2009 21:32:03 +0000 (21:32 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 17 Sep 2009 21:32:03 +0000 (21:32 +0000)
commit81b747b7fcc91c2fba9a3183d8fac80adbfc1d3e
tree546d82d55d5de33b672e3b9e6e0b33f02b9a37d3
parent10880397d205009e06e278b4c25d17f28ddf2d4e
Initial implementation of a code-completion interface in Clang. In
essence, code completion is triggered by a magic "code completion"
token produced by the lexer [*], which the parser recognizes at
certain points in the grammar. The parser then calls into the Action
object with the appropriate CodeCompletionXXX action.

Sema implements the CodeCompletionXXX callbacks by performing minimal
translation, then forwarding them to a CodeCompletionConsumer
subclass, which uses the results of semantic analysis to provide
code-completion results. At present, only a single, "printing" code
completion consumer is available, for regression testing and
debugging. However, the design is meant to permit other
code-completion consumers.

This initial commit contains two code-completion actions: one for
member access, e.g., "x." or "p->", and one for
nested-name-specifiers, e.g., "std::". More code-completion actions
will follow, along with improved gathering of code-completion results
for the various contexts.

[*] In the current -code-completion-dump testing/debugging mode, the
file is truncated at the completion point and EOF is translated into
"code completion".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82166 91177308-0d34-0410-b5e6-96231b3b80d8
23 files changed:
include/clang/Basic/Diagnostic.h
include/clang/Basic/TokenKinds.def
include/clang/Lex/Lexer.h
include/clang/Lex/Preprocessor.h
include/clang/Parse/Action.h
include/clang/Sema/CodeCompleteConsumer.h [new file with mode: 0644]
include/clang/Sema/ParseAST.h
lib/Basic/Diagnostic.cpp
lib/Lex/Lexer.cpp
lib/Lex/Preprocessor.cpp
lib/Parse/ParseExpr.cpp
lib/Parse/ParseExprCXX.cpp
lib/Sema/CMakeLists.txt
lib/Sema/CodeCompleteConsumer.cpp [new file with mode: 0644]
lib/Sema/ParseAST.cpp
lib/Sema/Sema.cpp
lib/Sema/Sema.h
lib/Sema/SemaCodeComplete.cpp [new file with mode: 0644]
test/CMakeLists.txt
test/CodeCompletion/member-access.c [new file with mode: 0644]
test/CodeCompletion/member-access.cpp [new file with mode: 0644]
test/CodeCompletion/nested-name-specifier.cpp [new file with mode: 0644]
tools/clang-cc/clang-cc.cpp