CodeCompletionHandler.h revision 212904
1117395Skan//===--- CodeCompletionHandler.h - Preprocessor code completion -*- C++ -*-===//
2169689Skan//
3117395Skan//                     The LLVM Compiler Infrastructure
4117395Skan//
5117395Skan// This file is distributed under the University of Illinois Open Source
6117395Skan// License. See LICENSE.TXT for details.
7117395Skan//
8117395Skan//===----------------------------------------------------------------------===//
9117395Skan//
10117395Skan//  This file defines the CodeCompletionHandler interface, which provides
11117395Skan//  code-completion callbacks for the preprocessor.
12117395Skan//
13117395Skan//===----------------------------------------------------------------------===//
14117395Skan#ifndef LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
15117395Skan#define LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
16117395Skan
17117395Skannamespace clang {
18169689Skan
19169689Skanclass IdentifierInfo;
20117395Skanclass MacroInfo;
21132718Skan
22117395Skan/// \brief Callback handler that receives notifications when performing code
23132718Skan/// completion within the preprocessor.
24132718Skanclass CodeCompletionHandler {
25117395Skanpublic:
26117395Skan  virtual ~CodeCompletionHandler();
27169689Skan
28117395Skan  /// \brief Callback invoked when performing code completion for a preprocessor
29117395Skan  /// directive.
30117395Skan  ///
31117395Skan  /// This callback will be invoked when the preprocessor processes a '#' at the
32132718Skan  /// start of a line, followed by the code-completion token.
33132718Skan  ///
34132718Skan  /// \param InConditional Whether we're inside a preprocessor conditional
35132718Skan  /// already.
36117395Skan  virtual void CodeCompleteDirective(bool InConditional) { }
37117395Skan
38117395Skan  /// \brief Callback invoked when performing code completion within a block of
39117395Skan  /// code that was excluded due to preprocessor conditionals.
40132718Skan  virtual void CodeCompleteInConditionalExclusion() { }
41117395Skan
42132718Skan  /// \brief Callback invoked when performing code completion in a context
43117395Skan  /// where the name of a macro is expected.
44132718Skan  ///
45132718Skan  /// \param IsDefinition Whether this is the definition of a macro, e.g.,
46117395Skan  /// in a #define.
47117395Skan  virtual void CodeCompleteMacroName(bool IsDefinition) { }
48117395Skan
49117395Skan  /// \brief Callback invoked when performing code completion in a preprocessor
50117395Skan  /// expression, such as the condition of an #if or #elif directive.
51132718Skan  virtual void CodeCompletePreprocessorExpression() { }
52117395Skan
53117395Skan  /// \brief Callback invoked when performing code completion inside a
54117395Skan  /// function-like macro argument.
55117395Skan  virtual void CodeCompleteMacroArgument(IdentifierInfo *Macro,
56132718Skan                                         MacroInfo *MacroInfo,
57117395Skan                                         unsigned ArgumentIndex) { }
58117395Skan
59117395Skan  /// \brief Callback invoked when performing code completion in a part of the
60117395Skan  /// file where we expect natural language, e.g., a comment, string, or
61117395Skan  /// #error directive.
62117395Skan  virtual void CodeCompleteNaturalLanguage() { }
63117395Skan};
64117395Skan
65117395Skan}
66117395Skan
67117395Skan#endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
68117395Skan