aaron.ballman accepted this revision. aaron.ballman added a comment. LGTM aside from some nits, though please wait for @Quuxplusone to respond before landing.
================ Comment at: clang/lib/Sema/SemaLookup.cpp:4310-4311 if (NamedDecl *NewND = Correction.getCorrectionDecl()) { - std::string CorrectionStr = Correction.getAsString(SemaRef.getLangOpts()); - for (TypoResultList::iterator RI = CList.begin(), RIEnd = CList.end(); - RI != RIEnd; ++RI) { - // If the Correction refers to a decl already in the result list, - // replace the existing result if the string representation of Correction - // comes before the current result alphabetically, then stop as there is - // nothing more to be done to add Correction to the candidate set. - if (RI->getCorrectionDecl() == NewND) { - if (CorrectionStr < RI->getAsString(SemaRef.getLangOpts())) - *RI = Correction; - return; - } + auto RI = llvm::find_if(CList, [NewND](const TypoCorrection &typoCorr) { + return typoCorr.getCorrectionDecl() == NewND; + }); ---------------- ================ Comment at: clang/lib/Sema/SemaLookup.cpp:4317 + + auto IsDeprecated = [](Decl *decl) { + while (decl) { ---------------- Feel free to pick a better name than `D` (other than `Decl`, please!), just cleaning up the coding style nit. ================ Comment at: clang/lib/Sema/SemaLookup.cpp:4327 + // Prefer non deprecated Corrections over deprecated and only then + // sort using an alphabetical order + std::pair<bool, std::string> newKey = { ---------------- ================ Comment at: clang/lib/Sema/SemaLookup.cpp:4328-4332 + std::pair<bool, std::string> newKey = { + IsDeprecated(Correction.getFoundDecl()), + Correction.getAsString(SemaRef.getLangOpts())}; + + std::pair<bool, std::string> prevKey = { ---------------- CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116775/new/ https://reviews.llvm.org/D116775 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits