sammccall added inline comments.
================ Comment at: clangd/CodeComplete.cpp:325 +CodeCompletion::IncludeCandidates +moveNonInsertingIncludesToFront(CodeCompletion::IncludeCandidates Includes) { + if (Includes.size() <= 1) ---------------- this seems a bit overly complicated. It does seem like a worry that this code is hot enough to optimize, especially compared to *generating* the list. But I think we can do something simpler... ================ Comment at: clangd/CodeComplete.cpp:415 // Calculate include paths and edits for all possible headers. + llvm::SmallVector<CodeCompletion::IncludeCandidate, 1> IncludeCandidates; for (const auto &Inc : C.RankedIncludeHeaders) { ---------------- if this is really hot, you might want to reserve(C.RankedIncludeHeaders.size()) ================ Comment at: clangd/CodeComplete.cpp:422 Include.Insertion = Includes.insert(ToInclude->first); - Completion.Includes.push_back(std::move(Include)); + IncludeCandidates.push_back(std::move(Include)); } else ---------------- What about `(Include.Insertion ? InsertableCandidates : IncludeCandidates).push_back(std::move(Include))` where `InsertableCandidates` is a vector declared above, and then just move it onto the end of the list after the loop? Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D52617 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits