This patch enabled code completion for ClangREPL. The feature was built upon two
existing Clang components: a list completer for LineEditor and SemaCodeCompletion.
The former serves the main entry point to trigger the latter. Because a
completion point for a compiler instance needs to be unchanged once it is set,
an incremental compiler instance for code completion is created. In addition to
completion points, it differs from a regular incremental compiler in the following ways:
- It does not execute input.
- To obtain declarations or bindings from previous input in the same REPL
session, it carries over AST context source from the main compiler, i.e. the one
used for the interpreter.
- It contains a ReplCompletionConsumer, a subclass of
CodeCompletionConsumer. The consumer communicates completion results from
SemaCodeCompletion back to the list completer for the REPL.