clang  3.7.0
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 namespace clang {
18 
19 class IdentifierInfo;
20 class MacroInfo;
21 
22 /// \brief Callback handler that receives notifications when performing code
23 /// completion within the preprocessor.
25 public:
26  virtual ~CodeCompletionHandler();
27 
28  /// \brief Callback invoked when performing code completion for a preprocessor
29  /// directive.
30  ///
31  /// This callback will be invoked when the preprocessor processes a '#' at the
32  /// start of a line, followed by the code-completion token.
33  ///
34  /// \param InConditional Whether we're inside a preprocessor conditional
35  /// already.
36  virtual void CodeCompleteDirective(bool InConditional) { }
37 
38  /// \brief Callback invoked when performing code completion within a block of
39  /// code that was excluded due to preprocessor conditionals.
41 
42  /// \brief Callback invoked when performing code completion in a context
43  /// where the name of a macro is expected.
44  ///
45  /// \param IsDefinition Whether this is the definition of a macro, e.g.,
46  /// in a \#define.
47  virtual void CodeCompleteMacroName(bool IsDefinition) { }
48 
49  /// \brief Callback invoked when performing code completion in a preprocessor
50  /// expression, such as the condition of an \#if or \#elif directive.
52 
53  /// \brief Callback invoked when performing code completion inside a
54  /// function-like macro argument.
55  ///
56  /// There will be another callback invocation after the macro arguments are
57  /// parsed, so this callback should generally be used to note that the next
58  /// callback is invoked inside a macro argument.
61  unsigned ArgumentIndex) { }
62 
63  /// \brief Callback invoked when performing code completion in a part of the
64  /// file where we expect natural language, e.g., a comment, string, or
65  /// \#error directive.
66  virtual void CodeCompleteNaturalLanguage() { }
67 };
68 
69 }
70 
71 #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...
virtual void CodeCompleteDirective(bool InConditional)
Callback invoked when performing code completion for a preprocessor 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 ...
Encapsulates the data about a macro definition (e.g. its tokens).
Definition: MacroInfo.h:34
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.