Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:56

0001 //===--- CodeCompletionHandler.h - Preprocessor code completion -*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 //  This file defines the CodeCompletionHandler interface, which provides
0010 //  code-completion callbacks for the preprocessor.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 #ifndef LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
0014 #define LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H
0015 
0016 #include "llvm/ADT/StringRef.h"
0017 
0018 namespace clang {
0019 
0020 class IdentifierInfo;
0021 class MacroInfo;
0022 
0023 /// Callback handler that receives notifications when performing code
0024 /// completion within the preprocessor.
0025 class CodeCompletionHandler {
0026 public:
0027   virtual ~CodeCompletionHandler();
0028 
0029   /// Callback invoked when performing code completion for a preprocessor
0030   /// directive.
0031   ///
0032   /// This callback will be invoked when the preprocessor processes a '#' at the
0033   /// start of a line, followed by the code-completion token.
0034   ///
0035   /// \param InConditional Whether we're inside a preprocessor conditional
0036   /// already.
0037   virtual void CodeCompleteDirective(bool InConditional) { }
0038 
0039   /// Callback invoked when performing code completion within a block of
0040   /// code that was excluded due to preprocessor conditionals.
0041   virtual void CodeCompleteInConditionalExclusion() { }
0042 
0043   /// Callback invoked when performing code completion in a context
0044   /// where the name of a macro is expected.
0045   ///
0046   /// \param IsDefinition Whether this is the definition of a macro, e.g.,
0047   /// in a \#define.
0048   virtual void CodeCompleteMacroName(bool IsDefinition) { }
0049 
0050   /// Callback invoked when performing code completion in a preprocessor
0051   /// expression, such as the condition of an \#if or \#elif directive.
0052   virtual void CodeCompletePreprocessorExpression() { }
0053 
0054   /// Callback invoked when performing code completion inside a
0055   /// function-like macro argument.
0056   ///
0057   /// There will be another callback invocation after the macro arguments are
0058   /// parsed, so this callback should generally be used to note that the next
0059   /// callback is invoked inside a macro argument.
0060   virtual void CodeCompleteMacroArgument(IdentifierInfo *Macro,
0061                                          MacroInfo *MacroInfo,
0062                                          unsigned ArgumentIndex) { }
0063 
0064   /// Callback invoked when performing code completion inside the filename
0065   /// part of an #include directive. (Also #import, #include_next, etc).
0066   /// \p Dir is the directory relative to the include path.
0067   virtual void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled) {}
0068 
0069   /// Callback invoked when performing code completion in a part of the
0070   /// file where we expect natural language, e.g., a comment, string, or
0071   /// \#error directive.
0072   virtual void CodeCompleteNaturalLanguage() { }
0073 };
0074 
0075 }
0076 
0077 #endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H