clang  8.0.0svn
CodeCompletionHandler.h
Go to the documentation of this file.
1 //===--- CodeCompletionHandler.h - Preprocessor code completion -*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the CodeCompletionHandler interface, which provides
11 // code-completion callbacks for the preprocessor.
12 //
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
15 #define LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
16 
17 #include "llvm/ADT/StringRef.h"
18 
19 namespace clang {
20 
21 class IdentifierInfo;
22 class MacroInfo;
23 
24 /// Callback handler that receives notifications when performing code
25 /// completion within the preprocessor.
27 public:
28  virtual ~CodeCompletionHandler();
29 
30  /// Callback invoked when performing code completion for a preprocessor
31  /// directive.
32  ///
33  /// This callback will be invoked when the preprocessor processes a '#' at the
34  /// start of a line, followed by the code-completion token.
35  ///
36  /// \param InConditional Whether we're inside a preprocessor conditional
37  /// already.
38  virtual void CodeCompleteDirective(bool InConditional) { }
39 
40  /// Callback invoked when performing code completion within a block of
41  /// code that was excluded due to preprocessor conditionals.
43 
44  /// Callback invoked when performing code completion in a context
45  /// where the name of a macro is expected.
46  ///
47  /// \param IsDefinition Whether this is the definition of a macro, e.g.,
48  /// in a \#define.
49  virtual void CodeCompleteMacroName(bool IsDefinition) { }
50 
51  /// Callback invoked when performing code completion in a preprocessor
52  /// expression, such as the condition of an \#if or \#elif directive.
54 
55  /// Callback invoked when performing code completion inside a
56  /// function-like macro argument.
57  ///
58  /// There will be another callback invocation after the macro arguments are
59  /// parsed, so this callback should generally be used to note that the next
60  /// callback is invoked inside a macro argument.
63  unsigned ArgumentIndex) { }
64 
65  /// Callback invoked when performing code completion inside the filename
66  /// part of an #include directive. (Also #import, #include_next, etc).
67  /// \p Dir is the directory relative to the include path.
68  virtual void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled) {}
69 
70  /// Callback invoked when performing code completion in a part of the
71  /// file where we expect natural language, e.g., a comment, string, or
72  /// \#error directive.
73  virtual void CodeCompleteNaturalLanguage() { }
74 };
75 
76 }
77 
78 #endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
virtual void CodeCompleteNaturalLanguage()
Callback invoked when performing code completion in a part of the file where we expect natural langua...
One of these records is kept for each identifier that is lexed.
virtual void CodeCompleteDirective(bool InConditional)
Callback invoked when performing code completion for a preprocessor directive.
virtual void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled)
Callback invoked when performing code completion inside the filename part of an #include directive...
virtual void CodeCompleteInConditionalExclusion()
Callback invoked when performing code completion within a block of code that was excluded due to prep...
virtual void CodeCompletePreprocessorExpression()
Callback invoked when performing code completion in a preprocessor expression, such as the condition ...
Dataflow Directional Tag Classes.
Encapsulates the data about a macro definition (e.g.
Definition: MacroInfo.h:40
virtual void CodeCompleteMacroName(bool IsDefinition)
Callback invoked when performing code completion in a context where the name of a macro is expected...
Callback handler that receives notifications when performing code completion within the preprocessor...
virtual void CodeCompleteMacroArgument(IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned ArgumentIndex)
Callback invoked when performing code completion inside a function-like macro argument.