CodeCompletionHandler.h revision 267654
1155192Srwatson//===--- CodeCompletionHandler.h - Preprocessor code completion -*- C++ -*-===//
2155192Srwatson//
3155192Srwatson//                     The LLVM Compiler Infrastructure
4155192Srwatson//
5155192Srwatson// This file is distributed under the University of Illinois Open Source
6155192Srwatson// License. See LICENSE.TXT for details.
7155192Srwatson//
8155192Srwatson//===----------------------------------------------------------------------===//
9155192Srwatson//
10155192Srwatson//  This file defines the CodeCompletionHandler interface, which provides
11155192Srwatson//  code-completion callbacks for the preprocessor.
12155192Srwatson//
13155192Srwatson//===----------------------------------------------------------------------===//
14155192Srwatson#ifndef LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
15155192Srwatson#define LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
16155192Srwatson
17155192Srwatsonnamespace clang {
18155192Srwatson
19155192Srwatsonclass IdentifierInfo;
20155192Srwatsonclass MacroInfo;
21155192Srwatson
22155192Srwatson/// \brief Callback handler that receives notifications when performing code
23155192Srwatson/// completion within the preprocessor.
24155192Srwatsonclass CodeCompletionHandler {
25155192Srwatsonpublic:
26155192Srwatson  virtual ~CodeCompletionHandler();
27155192Srwatson
28155192Srwatson  /// \brief Callback invoked when performing code completion for a preprocessor
29155192Srwatson  /// directive.
30155192Srwatson  ///
31155192Srwatson  /// This callback will be invoked when the preprocessor processes a '#' at the
32155192Srwatson  /// start of a line, followed by the code-completion token.
33155192Srwatson  ///
34155192Srwatson  /// \param InConditional Whether we're inside a preprocessor conditional
35155192Srwatson  /// already.
36155192Srwatson  virtual void CodeCompleteDirective(bool InConditional) { }
37155192Srwatson
38155192Srwatson  /// \brief Callback invoked when performing code completion within a block of
39155192Srwatson  /// code that was excluded due to preprocessor conditionals.
40155192Srwatson  virtual void CodeCompleteInConditionalExclusion() { }
41155192Srwatson
42155192Srwatson  /// \brief Callback invoked when performing code completion in a context
43155192Srwatson  /// where the name of a macro is expected.
44155192Srwatson  ///
45155192Srwatson  /// \param IsDefinition Whether this is the definition of a macro, e.g.,
46155192Srwatson  /// in a \#define.
47155192Srwatson  virtual void CodeCompleteMacroName(bool IsDefinition) { }
48155192Srwatson
49155192Srwatson  /// \brief Callback invoked when performing code completion in a preprocessor
50155192Srwatson  /// expression, such as the condition of an \#if or \#elif directive.
51155192Srwatson  virtual void CodeCompletePreprocessorExpression() { }
52155192Srwatson
53155192Srwatson  /// \brief Callback invoked when performing code completion inside a
54155192Srwatson  /// function-like macro argument.
55155192Srwatson  ///
56155192Srwatson  /// There will be another callback invocation after the macro arguments are
57155192Srwatson  /// parsed, so this callback should generally be used to note that the next
58155192Srwatson  /// callback is invoked inside a macro argument.
59155192Srwatson  virtual void CodeCompleteMacroArgument(IdentifierInfo *Macro,
60155192Srwatson                                         MacroInfo *MacroInfo,
61155192Srwatson                                         unsigned ArgumentIndex) { }
62155192Srwatson
63155192Srwatson  /// \brief Callback invoked when performing code completion in a part of the
64155192Srwatson  /// file where we expect natural language, e.g., a comment, string, or
65155192Srwatson  /// \#error directive.
66155192Srwatson  virtual void CodeCompleteNaturalLanguage() { }
67155192Srwatson};
68155192Srwatson
69155192Srwatson}
70155192Srwatson
71155192Srwatson#endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
72155192Srwatson