Author: Simon Pilgrim Date: 2021-01-23T11:04:00Z New Revision: 344afa853fcfcc085cb5c957b4a07c7ea013bb1b
URL: https://github.com/llvm/llvm-project/commit/344afa853fcfcc085cb5c957b4a07c7ea013bb1b DIFF: https://github.com/llvm/llvm-project/commit/344afa853fcfcc085cb5c957b4a07c7ea013bb1b.diff LOG: [Support] TrigramIndex::insert - pass std::String argument by const reference. NFCI. Avoid string copies and fix clang-tidy warning. Added: Modified: llvm/include/llvm/Support/TrigramIndex.h llvm/lib/Support/TrigramIndex.cpp Removed: ################################################################################ diff --git a/llvm/include/llvm/Support/TrigramIndex.h b/llvm/include/llvm/Support/TrigramIndex.h index 360ab9459790..0be6a1012718 100644 --- a/llvm/include/llvm/Support/TrigramIndex.h +++ b/llvm/include/llvm/Support/TrigramIndex.h @@ -38,7 +38,7 @@ class StringRef; class TrigramIndex { public: /// Inserts a new Regex into the index. - void insert(std::string Regex); + void insert(const std::string &Regex); /// Returns true, if special case list definitely does not have a line /// that matches the query. Returns false, if it's not sure. diff --git a/llvm/lib/Support/TrigramIndex.cpp b/llvm/lib/Support/TrigramIndex.cpp index 1f1f3022b0b3..4370adc9c3e0 100644 --- a/llvm/lib/Support/TrigramIndex.cpp +++ b/llvm/lib/Support/TrigramIndex.cpp @@ -25,7 +25,7 @@ static bool isAdvancedMetachar(unsigned Char) { return strchr(RegexAdvancedMetachars, Char) != nullptr; } -void TrigramIndex::insert(std::string Regex) { +void TrigramIndex::insert(const std::string &Regex) { if (Defeated) return; std::set<unsigned> Was; unsigned Cnt = 0; _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits