clang API Documentation
00001 //===--- CodeCompletionHandler.h - Preprocessor code completion -*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the CodeCompletionHandler interface, which provides 00011 // code-completion callbacks for the preprocessor. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 #ifndef LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H 00015 #define LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H 00016 00017 namespace clang { 00018 00019 class IdentifierInfo; 00020 class MacroInfo; 00021 00022 /// \brief Callback handler that receives notifications when performing code 00023 /// completion within the preprocessor. 00024 class CodeCompletionHandler { 00025 public: 00026 virtual ~CodeCompletionHandler(); 00027 00028 /// \brief Callback invoked when performing code completion for a preprocessor 00029 /// directive. 00030 /// 00031 /// This callback will be invoked when the preprocessor processes a '#' at the 00032 /// start of a line, followed by the code-completion token. 00033 /// 00034 /// \param InConditional Whether we're inside a preprocessor conditional 00035 /// already. 00036 virtual void CodeCompleteDirective(bool InConditional) { } 00037 00038 /// \brief Callback invoked when performing code completion within a block of 00039 /// code that was excluded due to preprocessor conditionals. 00040 virtual void CodeCompleteInConditionalExclusion() { } 00041 00042 /// \brief Callback invoked when performing code completion in a context 00043 /// where the name of a macro is expected. 00044 /// 00045 /// \param IsDefinition Whether this is the definition of a macro, e.g., 00046 /// in a \#define. 00047 virtual void CodeCompleteMacroName(bool IsDefinition) { } 00048 00049 /// \brief Callback invoked when performing code completion in a preprocessor 00050 /// expression, such as the condition of an \#if or \#elif directive. 00051 virtual void CodeCompletePreprocessorExpression() { } 00052 00053 /// \brief Callback invoked when performing code completion inside a 00054 /// function-like macro argument. 00055 /// 00056 /// There will be another callback invocation after the macro arguments are 00057 /// parsed, so this callback should generally be used to note that the next 00058 /// callback is invoked inside a macro argument. 00059 virtual void CodeCompleteMacroArgument(IdentifierInfo *Macro, 00060 MacroInfo *MacroInfo, 00061 unsigned ArgumentIndex) { } 00062 00063 /// \brief Callback invoked when performing code completion in a part of the 00064 /// file where we expect natural language, e.g., a comment, string, or 00065 /// \#error directive. 00066 virtual void CodeCompleteNaturalLanguage() { } 00067 }; 00068 00069 } 00070 00071 #endif // LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H