]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Lex/CodeCompletionHandler.h
Merge clang trunk r351319, resolve conflicts, and update FREEBSD-Xlist.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / Lex / CodeCompletionHandler.h
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
17 #include "llvm/ADT/StringRef.h"
18
19 namespace clang {
20
21 class IdentifierInfo;
22 class MacroInfo;
23
24 /// Callback handler that receives notifications when performing code
25 /// completion within the preprocessor.
26 class CodeCompletionHandler {
27 public:
28   virtual ~CodeCompletionHandler();
29
30   /// Callback invoked when performing code completion for a preprocessor
31   /// directive.
32   ///
33   /// This callback will be invoked when the preprocessor processes a '#' at the
34   /// start of a line, followed by the code-completion token.
35   ///
36   /// \param InConditional Whether we're inside a preprocessor conditional
37   /// already.
38   virtual void CodeCompleteDirective(bool InConditional) { }
39
40   /// Callback invoked when performing code completion within a block of
41   /// code that was excluded due to preprocessor conditionals.
42   virtual void CodeCompleteInConditionalExclusion() { }
43
44   /// Callback invoked when performing code completion in a context
45   /// where the name of a macro is expected.
46   ///
47   /// \param IsDefinition Whether this is the definition of a macro, e.g.,
48   /// in a \#define.
49   virtual void CodeCompleteMacroName(bool IsDefinition) { }
50
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() { }
54
55   /// Callback invoked when performing code completion inside a
56   /// function-like macro argument.
57   ///
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,
62                                          MacroInfo *MacroInfo,
63                                          unsigned ArgumentIndex) { }
64
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) {}
69
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() { }
74 };
75
76 }
77
78 #endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H