1 //===----- CodeCompletion.h - Code Completion for ClangRepl ---===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the classes which performs code completion at the REPL.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_INTERPRETER_CODE_COMPLETION_H
14 #define LLVM_CLANG_INTERPRETER_CODE_COMPLETION_H
15 #include <string>
16 #include <vector>
17 
18 namespace llvm {
19 class StringRef;
20 } // namespace llvm
21 
22 namespace clang {
23 class CodeCompletionResult;
24 class CompilerInstance;
25 
26 struct ReplCodeCompleter {
27   ReplCodeCompleter() = default;
28   std::string Prefix;
29 
30   /// \param InterpCI [in] The compiler instance that is used to trigger code
31   /// completion
32 
33   /// \param Content [in] The string where code completion is triggered.
34 
35   /// \param Line [in] The line number of the code completion point.
36 
37   /// \param Col [in] The column number of the code completion point.
38 
39   /// \param ParentCI [in] The running interpreter compiler instance that
40   /// provides ASTContexts.
41 
42   /// \param CCResults [out] The completion results.
43   void codeComplete(CompilerInstance *InterpCI, llvm::StringRef Content,
44                     unsigned Line, unsigned Col,
45                     const CompilerInstance *ParentCI,
46                     std::vector<std::string> &CCResults);
47 };
48 } // namespace clang
49 #endif
50