• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
24 class CodeCompletionHandler {
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.
CodeCompleteDirective(bool InConditional)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.
CodeCompleteInConditionalExclusion()40   virtual void CodeCompleteInConditionalExclusion() { }
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.
CodeCompleteMacroName(bool IsDefinition)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.
CodeCompletePreprocessorExpression()51   virtual void CodeCompletePreprocessorExpression() { }
52 
53   /// \brief Callback invoked when performing code completion inside a
54   /// function-like macro argument.
CodeCompleteMacroArgument(IdentifierInfo * Macro,MacroInfo * MacroInfo,unsigned ArgumentIndex)55   virtual void CodeCompleteMacroArgument(IdentifierInfo *Macro,
56                                          MacroInfo *MacroInfo,
57                                          unsigned ArgumentIndex) { }
58 
59   /// \brief Callback invoked when performing code completion in a part of the
60   /// file where we expect natural language, e.g., a comment, string, or
61   /// #error directive.
CodeCompleteNaturalLanguage()62   virtual void CodeCompleteNaturalLanguage() { }
63 };
64 
65 }
66 
67 #endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
68