1f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor//===--- CodeCompletionHandler.h - Preprocessor code completion -*- C++ -*-===//
2f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor//
3f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor//                     The LLVM Compiler Infrastructure
4f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor//
5f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor// This file is distributed under the University of Illinois Open Source
6f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor// License. See LICENSE.TXT for details.
7f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor//
8f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor//===----------------------------------------------------------------------===//
9f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor//
10f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor//  This file defines the CodeCompletionHandler interface, which provides
11f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor//  code-completion callbacks for the preprocessor.
12f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor//
13f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor//===----------------------------------------------------------------------===//
14f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor#ifndef LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
15f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor#define LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
16f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor
17f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregornamespace clang {
18f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor
19f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregorclass IdentifierInfo;
20f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregorclass MacroInfo;
21f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregor
22f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor/// \brief Callback handler that receives notifications when performing code
23f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor/// completion within the preprocessor.
24f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregorclass CodeCompletionHandler {
25f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregorpublic:
26f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  virtual ~CodeCompletionHandler();
27f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor
28f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  /// \brief Callback invoked when performing code completion for a preprocessor
29f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  /// directive.
30f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  ///
31f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  /// This callback will be invoked when the preprocessor processes a '#' at the
32f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  /// start of a line, followed by the code-completion token.
33f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  ///
34f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  /// \param InConditional Whether we're inside a preprocessor conditional
35f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  /// already.
36f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  virtual void CodeCompleteDirective(bool InConditional) { }
37f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor
38f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  /// \brief Callback invoked when performing code completion within a block of
39f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  /// code that was excluded due to preprocessor conditionals.
40f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor  virtual void CodeCompleteInConditionalExclusion() { }
411fbb447e9d43c2c676e94081fbfee7eb6cbe933bDouglas Gregor
421fbb447e9d43c2c676e94081fbfee7eb6cbe933bDouglas Gregor  /// \brief Callback invoked when performing code completion in a context
431fbb447e9d43c2c676e94081fbfee7eb6cbe933bDouglas Gregor  /// where the name of a macro is expected.
441fbb447e9d43c2c676e94081fbfee7eb6cbe933bDouglas Gregor  ///
451fbb447e9d43c2c676e94081fbfee7eb6cbe933bDouglas Gregor  /// \param IsDefinition Whether this is the definition of a macro, e.g.,
4636be6c43533194ed5c7613f33851c7bc390f1c8eJames Dennett  /// in a \#define.
471fbb447e9d43c2c676e94081fbfee7eb6cbe933bDouglas Gregor  virtual void CodeCompleteMacroName(bool IsDefinition) { }
48f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregor
49f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregor  /// \brief Callback invoked when performing code completion in a preprocessor
50809d1be9820039b4cf6efa48246a0d70ffa13394James Dennett  /// expression, such as the condition of an \#if or \#elif directive.
51f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregor  virtual void CodeCompletePreprocessorExpression() { }
52f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregor
53f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregor  /// \brief Callback invoked when performing code completion inside a
54f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregor  /// function-like macro argument.
555c5f03e4020e90b9760ec547962ba02b029cc359Argyrios Kyrtzidis  ///
565c5f03e4020e90b9760ec547962ba02b029cc359Argyrios Kyrtzidis  /// There will be another callback invocation after the macro arguments are
575c5f03e4020e90b9760ec547962ba02b029cc359Argyrios Kyrtzidis  /// parsed, so this callback should generally be used to note that the next
585c5f03e4020e90b9760ec547962ba02b029cc359Argyrios Kyrtzidis  /// callback is invoked inside a macro argument.
59f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregor  virtual void CodeCompleteMacroArgument(IdentifierInfo *Macro,
60f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregor                                         MacroInfo *MacroInfo,
61f29c5233085a5af795c3c01b94d319e5b3235d56Douglas Gregor                                         unsigned ArgumentIndex) { }
6255817afdf9d453a443262a733f6caf6692dca118Douglas Gregor
6355817afdf9d453a443262a733f6caf6692dca118Douglas Gregor  /// \brief Callback invoked when performing code completion in a part of the
6455817afdf9d453a443262a733f6caf6692dca118Douglas Gregor  /// file where we expect natural language, e.g., a comment, string, or
65809d1be9820039b4cf6efa48246a0d70ffa13394James Dennett  /// \#error directive.
6655817afdf9d453a443262a733f6caf6692dca118Douglas Gregor  virtual void CodeCompleteNaturalLanguage() { }
67f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor};
68f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor
69f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor}
70f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor
71f44e854ed1e3aa86d2ed6d615ccd109d50ddcff9Douglas Gregor#endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
72