From 3d8051abb8ead54c2eb67a7a45193d59daf6d847 Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Tue, 18 Sep 2018 08:40:41 +0000 Subject: [CodeComplete] Add completions for filenames in #include directives. Summary: The dir component ("somedir" in #include ) is considered fixed. We append "foo" to each directory on the include path, and then list its files. Completions are of the forms: #include fox/ The filter is set to the filename part ("fo"), so fuzzy matching can be applied to the filename only. No fancy scoring/priorities are set, and no information is added to CodeCompleteResult to make smart scoring possible. Could be in future. Reviewers: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52076 llvm-svn: 342449 --- clang/lib/Lex/Preprocessor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'clang/lib/Lex/Preprocessor.cpp') diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index dcff51ad61b..48b3571ab27 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -445,6 +445,13 @@ bool Preprocessor::SetCodeCompletionPoint(const FileEntry *File, return false; } +void Preprocessor::CodeCompleteIncludedFile(llvm::StringRef Dir, + bool IsAngled) { + if (CodeComplete) + CodeComplete->CodeCompleteIncludedFile(Dir, IsAngled); + setCodeCompletionReached(); +} + void Preprocessor::CodeCompleteNaturalLanguage() { if (CodeComplete) CodeComplete->CodeCompleteNaturalLanguage(); -- cgit v1.2.3