clang 23.0.0git
CodeCompletionHandler.h
Go to the documentation of this file.
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
18#include "llvm/ADT/StringRef.h"
19
20namespace clang {
21
22class IdentifierInfo;
23class MacroInfo;
25
26/// Callback handler that receives notifications when performing code
27/// completion within the preprocessor.
29public:
31
32 /// Callback invoked when performing code completion for a preprocessor
33 /// directive.
34 ///
35 /// This callback will be invoked when the preprocessor processes a '#' at the
36 /// start of a line, followed by the code-completion token.
37 ///
38 /// \param InConditional Whether we're inside a preprocessor conditional
39 /// already.
40 virtual void CodeCompleteDirective(bool InConditional) { }
41
42 /// Callback invoked when performing code completion within a block of
43 /// code that was excluded due to preprocessor conditionals.
45
46 /// Callback invoked when performing code completion in a context
47 /// where the name of a macro is expected.
48 ///
49 /// \param IsDefinition Whether this is the definition of a macro, e.g.,
50 /// in a \#define.
51 virtual void CodeCompleteMacroName(bool IsDefinition) { }
52
53 /// Callback invoked when performing code completion in a preprocessor
54 /// expression, such as the condition of an \#if or \#elif directive.
56
57 /// Callback invoked when performing code completion inside a
58 /// function-like macro argument.
59 ///
60 /// There will be another callback invocation after the macro arguments are
61 /// parsed, so this callback should generally be used to note that the next
62 /// callback is invoked inside a macro argument.
65 unsigned ArgumentIndex) { }
66
67 /// Callback invoked when performing code completion inside the filename
68 /// part of an #include directive. (Also #import, #include_next, etc).
69 /// \p Dir is the directory relative to the include path.
70 virtual void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled) {}
71
72 /// Callback invoked when performing code completion in a part of the
73 /// file where we expect natural language, e.g., a comment, string, or
74 /// \#error directive.
75 virtual void CodeCompleteNaturalLanguage() { }
76
77 /// Callback invoked when performing code completion inside the module name
78 /// part of an import directive.
80 ModuleIdPath Path) {}
81};
82
83}
84
85#endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Defines the clang::SourceLocation class and associated facilities.
Callback handler that receives notifications when performing code completion within the preprocessor.
virtual void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled)
Callback invoked when performing code completion inside the filename part of an include directive.
virtual void CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path)
Callback invoked when performing code completion inside the module name part of an import directive.
virtual void CodeCompleteMacroArgument(IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned ArgumentIndex)
Callback invoked when performing code completion inside a function-like macro argument.
virtual void CodeCompleteMacroName(bool IsDefinition)
Callback invoked when performing code completion in a context where the name of a macro is expected.
virtual void CodeCompletePreprocessorExpression()
Callback invoked when performing code completion in a preprocessor expression, such as the condition ...
virtual void CodeCompleteNaturalLanguage()
Callback invoked when performing code completion in a part of the file where we expect natural langua...
virtual void CodeCompleteInConditionalExclusion()
Callback invoked when performing code completion within a block of code that was excluded due to prep...
virtual void CodeCompleteDirective(bool InConditional)
Callback invoked when performing code completion for a preprocessor directive.
One of these records is kept for each identifier that is lexed.
Encapsulates the data about a macro definition (e.g.
Definition MacroInfo.h:39
Encodes a location in the source.
The JSON file list parser is used to communicate input to InstallAPI.
ArrayRef< IdentifierLoc > ModuleIdPath
A sequence of identifier/location pairs used to describe a particular module or submodule,...