diff options
Diffstat (limited to 'clang/include')
-rw-r--r-- | clang/include/clang-c/Index.h | 7 | ||||
-rw-r--r-- | clang/include/clang/Lex/CodeCompletionHandler.h | 7 | ||||
-rw-r--r-- | clang/include/clang/Lex/Lexer.h | 3 | ||||
-rw-r--r-- | clang/include/clang/Lex/Preprocessor.h | 4 | ||||
-rw-r--r-- | clang/include/clang/Parse/Parser.h | 1 | ||||
-rw-r--r-- | clang/include/clang/Sema/CodeCompleteConsumer.h | 3 | ||||
-rw-r--r-- | clang/include/clang/Sema/Sema.h | 1 |
7 files changed, 25 insertions, 1 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index 86383d13510..56b510d03ab 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -5606,9 +5606,14 @@ enum CXCompletionContext { CXCompletionContext_NaturalLanguage = 1 << 21, /** + * #include file completions should be included in the results. + */ + CXCompletionContext_IncludedFile = 1 << 22, + + /** * The current context is unknown, so set all contexts. */ - CXCompletionContext_Unknown = ((1 << 22) - 1) + CXCompletionContext_Unknown = ((1 << 23) - 1) }; /** diff --git a/clang/include/clang/Lex/CodeCompletionHandler.h b/clang/include/clang/Lex/CodeCompletionHandler.h index 87089fd7d50..6b368c74c5f 100644 --- a/clang/include/clang/Lex/CodeCompletionHandler.h +++ b/clang/include/clang/Lex/CodeCompletionHandler.h @@ -14,6 +14,8 @@ #ifndef LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H #define LLVM_CLANG_LEX_CODECOMPLETIONHANDLER_H +#include "llvm/ADT/StringRef.h" + namespace clang { class IdentifierInfo; @@ -60,6 +62,11 @@ public: MacroInfo *MacroInfo, unsigned ArgumentIndex) { } + /// Callback invoked when performing code completion inside the filename + /// part of an #include directive. (Also #import, #include_next, etc). + /// \p Dir is the directory relative to the include path, e.g. "a" for <a/b. + virtual void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled) {} + /// Callback invoked when performing code completion in a part of the /// file where we expect natural language, e.g., a comment, string, or /// \#error directive. diff --git a/clang/include/clang/Lex/Lexer.h b/clang/include/clang/Lex/Lexer.h index 7af9d43b3f5..a9b10b62732 100644 --- a/clang/include/clang/Lex/Lexer.h +++ b/clang/include/clang/Lex/Lexer.h @@ -711,6 +711,9 @@ private: bool isHexaLiteral(const char *Start, const LangOptions &LangOpts); + void codeCompleteIncludedFile(const char *PathStart, + const char *CompletionPoint, bool IsAngled); + /// Read a universal character name. /// /// \param StartPtr The position in the source buffer after the initial '\'. diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h index 02ea80aa3fc..75910011d04 100644 --- a/clang/include/clang/Lex/Preprocessor.h +++ b/clang/include/clang/Lex/Preprocessor.h @@ -1128,6 +1128,10 @@ public: CodeComplete = nullptr; } + /// Hook used by the lexer to invoke the "included file" code + /// completion point. + void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled); + /// Hook used by the lexer to invoke the "natural language" code /// completion point. void CodeCompleteNaturalLanguage(); diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index 5b3bfb5a077..e70a19be47d 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -2969,6 +2969,7 @@ private: void CodeCompletePreprocessorExpression() override; void CodeCompleteMacroArgument(IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned ArgumentIndex) override; + void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled) override; void CodeCompleteNaturalLanguage() override; }; diff --git a/clang/include/clang/Sema/CodeCompleteConsumer.h b/clang/include/clang/Sema/CodeCompleteConsumer.h index 9e1c7e257c7..3e7286b8e9f 100644 --- a/clang/include/clang/Sema/CodeCompleteConsumer.h +++ b/clang/include/clang/Sema/CodeCompleteConsumer.h @@ -323,6 +323,9 @@ public: /// Code completion where an Objective-C category name is expected. CCC_ObjCCategoryName, + /// Code completion inside the filename part of a #include directive. + CCC_IncludedFile, + /// An unknown context, in which we are recovering from a parsing /// error and don't know which completions we should give. CCC_Recovery diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 293b5481015..a701876948f 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -10345,6 +10345,7 @@ public: IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned Argument); + void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled); void CodeCompleteNaturalLanguage(); void CodeCompleteAvailabilityPlatformName(); void GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator, |