Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | //===--- CodeCompletionHandler.h - Preprocessor code completion -*- C++ -*-===// |
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 CodeCompletionHandler interface, which provides |
||
10 | // code-completion callbacks for the preprocessor. |
||
11 | // |
||
12 | //===----------------------------------------------------------------------===// |
||
13 | #ifndef LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H |
||
14 | #define LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H |
||
15 | |||
16 | #include "llvm/ADT/StringRef.h" |
||
17 | |||
18 | namespace clang { |
||
19 | |||
20 | class IdentifierInfo; |
||
21 | class MacroInfo; |
||
22 | |||
23 | /// Callback handler that receives notifications when performing code |
||
24 | /// completion within the preprocessor. |
||
25 | class CodeCompletionHandler { |
||
26 | public: |
||
27 | virtual ~CodeCompletionHandler(); |
||
28 | |||
29 | /// Callback invoked when performing code completion for a preprocessor |
||
30 | /// directive. |
||
31 | /// |
||
32 | /// This callback will be invoked when the preprocessor processes a '#' at the |
||
33 | /// start of a line, followed by the code-completion token. |
||
34 | /// |
||
35 | /// \param InConditional Whether we're inside a preprocessor conditional |
||
36 | /// already. |
||
37 | virtual void CodeCompleteDirective(bool InConditional) { } |
||
38 | |||
39 | /// Callback invoked when performing code completion within a block of |
||
40 | /// code that was excluded due to preprocessor conditionals. |
||
41 | virtual void CodeCompleteInConditionalExclusion() { } |
||
42 | |||
43 | /// Callback invoked when performing code completion in a context |
||
44 | /// where the name of a macro is expected. |
||
45 | /// |
||
46 | /// \param IsDefinition Whether this is the definition of a macro, e.g., |
||
47 | /// in a \#define. |
||
48 | virtual void CodeCompleteMacroName(bool IsDefinition) { } |
||
49 | |||
50 | /// Callback invoked when performing code completion in a preprocessor |
||
51 | /// expression, such as the condition of an \#if or \#elif directive. |
||
52 | virtual void CodeCompletePreprocessorExpression() { } |
||
53 | |||
54 | /// Callback invoked when performing code completion inside a |
||
55 | /// function-like macro argument. |
||
56 | /// |
||
57 | /// There will be another callback invocation after the macro arguments are |
||
58 | /// parsed, so this callback should generally be used to note that the next |
||
59 | /// callback is invoked inside a macro argument. |
||
60 | virtual void CodeCompleteMacroArgument(IdentifierInfo *Macro, |
||
61 | MacroInfo *MacroInfo, |
||
62 | unsigned ArgumentIndex) { } |
||
63 | |||
64 | /// Callback invoked when performing code completion inside the filename |
||
65 | /// part of an #include directive. (Also #import, #include_next, etc). |
||
66 | /// \p Dir is the directory relative to the include path. |
||
67 | virtual void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled) {} |
||
68 | |||
69 | /// Callback invoked when performing code completion in a part of the |
||
70 | /// file where we expect natural language, e.g., a comment, string, or |
||
71 | /// \#error directive. |
||
72 | virtual void CodeCompleteNaturalLanguage() { } |
||
73 | }; |
||
74 | |||
75 | } |
||
76 | |||
77 | #endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H |