1 //===--- CodeCompletionHandler.h - Preprocessor code completion -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the CodeCompletionHandler interface, which provides
11 // code-completion callbacks for the preprocessor.
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
15 #define LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
17 #include "llvm/ADT/StringRef.h"
24 /// Callback handler that receives notifications when performing code
25 /// completion within the preprocessor.
26 class CodeCompletionHandler {
28 virtual ~CodeCompletionHandler();
30 /// Callback invoked when performing code completion for a preprocessor
33 /// This callback will be invoked when the preprocessor processes a '#' at the
34 /// start of a line, followed by the code-completion token.
36 /// \param InConditional Whether we're inside a preprocessor conditional
38 virtual void CodeCompleteDirective(bool InConditional) { }
40 /// Callback invoked when performing code completion within a block of
41 /// code that was excluded due to preprocessor conditionals.
42 virtual void CodeCompleteInConditionalExclusion() { }
44 /// Callback invoked when performing code completion in a context
45 /// where the name of a macro is expected.
47 /// \param IsDefinition Whether this is the definition of a macro, e.g.,
49 virtual void CodeCompleteMacroName(bool IsDefinition) { }
51 /// Callback invoked when performing code completion in a preprocessor
52 /// expression, such as the condition of an \#if or \#elif directive.
53 virtual void CodeCompletePreprocessorExpression() { }
55 /// Callback invoked when performing code completion inside a
56 /// function-like macro argument.
58 /// There will be another callback invocation after the macro arguments are
59 /// parsed, so this callback should generally be used to note that the next
60 /// callback is invoked inside a macro argument.
61 virtual void CodeCompleteMacroArgument(IdentifierInfo *Macro,
63 unsigned ArgumentIndex) { }
65 /// Callback invoked when performing code completion inside the filename
66 /// part of an #include directive. (Also #import, #include_next, etc).
67 /// \p Dir is the directory relative to the include path.
68 virtual void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled) {}
70 /// Callback invoked when performing code completion in a part of the
71 /// file where we expect natural language, e.g., a comment, string, or
72 /// \#error directive.
73 virtual void CodeCompleteNaturalLanguage() { }
78 #endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H