summaryrefslogtreecommitdiffstats
path: root/src/linguist/linguist/phraseview.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-08 19:56:03 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-10 21:02:08 +0200
commit675a7f59025d40d4813bce70d72ce087024fb008 (patch)
tree48b9d173109ac94c69b2d2c3e302c404e10563ee /src/linguist/linguist/phraseview.cpp
parent63541a15e21d3ced40e516705c904a4939cb70f1 (diff)
Port from container::count() and length() to size() - V4
This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); a.k.a qt-port-to-std-compatible-api V4 with config Scope: 'Container'. Change-Id: I58e1b41b91c34d2e860dbb5847b3752edbfc6fc9 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/linguist/linguist/phraseview.cpp')
-rw-r--r--src/linguist/linguist/phraseview.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/linguist/linguist/phraseview.cpp b/src/linguist/linguist/phraseview.cpp
index 3cc4718a7..81e7d49de 100644
--- a/src/linguist/linguist/phraseview.cpp
+++ b/src/linguist/linguist/phraseview.cpp
@@ -194,9 +194,9 @@ static CandidateList similarTextHeuristicCandidates(MultiDataModel *model, int m
int score = stringmatcher.getSimilarityScore(s);
- if (candidates.count() == maxCandidates && score > scores[maxCandidates - 1])
+ if (candidates.size() == maxCandidates && score > scores[maxCandidates - 1])
candidates.removeLast();
- if (candidates.count() < maxCandidates && score >= textSimilarityThreshold ) {
+ if (candidates.size() < maxCandidates && score >= textSimilarityThreshold ) {
Candidate cand(mtm.context(), s, mtm.comment(), mtm.translation());
int i;