llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Miko (mikomikotaishi) <details> <summary>Changes</summary> This PR removes module partitions that don't belong to the current file's module from the list of suggested module imports in the code completion, so that it contains only primary modules or partitions directly relevant to the declared primary module. --- Full diff: https://github.com/llvm/llvm-project/pull/187657.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaCodeComplete.cpp (+8) ``````````diff diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 98d78d2a461f1..d2f5cea069ceb 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -4602,7 +4602,15 @@ void SemaCodeCompletion::CodeCompleteModuleImport(SourceLocation ImportLoc, // Enumerate all top-level modules. SmallVector<Module *, 8> Modules; SemaRef.PP.getHeaderSearchInfo().collectAllModules(Modules); + Module *CurrentModule = SemaRef.getCurrentModule(); for (unsigned I = 0, N = Modules.size(); I != N; ++I) { + // Skip module partitions that don't belong to the current file's declared module + if (Modules[I]->isModulePartition()) { + if (!CurrentModule || + Modules[I]->getPrimaryModuleInterfaceName() != + CurrentModule->getPrimaryModuleInterfaceName()) + continue; + } Builder.AddTypedTextChunk( Builder.getAllocator().CopyString(Modules[I]->Name)); Results.AddResult(Result( `````````` </details> https://github.com/llvm/llvm-project/pull/187657 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
