CodeCompletionHandler.h revision f29c5233085a5af795c3c01b94d319e5b3235d56
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
17namespace clang {
18
19class IdentifierInfo;
20class MacroInfo;
21
22/// \brief Callback handler that receives notifications when performing code
23/// completion within the preprocessor.
24class CodeCompletionHandler {
25public:
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.
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.
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.
51  virtual void CodeCompletePreprocessorExpression() { }
52
53  /// \brief Callback invoked when performing code completion inside a
54  /// function-like macro argument.
55  virtual void CodeCompleteMacroArgument(IdentifierInfo *Macro,
56                                         MacroInfo *MacroInfo,
57                                         unsigned ArgumentIndex) { }
58};
59
60}
61
62#endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
63