From 675a7f59025d40d4813bce70d72ce087024fb008 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 8 Oct 2022 19:56:03 +0200 Subject: 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 classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef 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(, "count", "size"); renameMethod(, "length", "size"); a.k.a qt-port-to-std-compatible-api V4 with config Scope: 'Container'. Change-Id: I58e1b41b91c34d2e860dbb5847b3752edbfc6fc9 Reviewed-by: Ivan Solovev --- src/qdoc/cppcodeparser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qdoc/cppcodeparser.cpp') diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index 5dbd7d59a..aa9c8864d 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -402,8 +402,8 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis // valid nodes. Note that it's important to do this *after* constructing // the topic nodes - which need to be written to index before the related // scn. - if (sharedNodes.count() > 1) { - auto *scn = new SharedCommentNode(qmlType, sharedNodes.count(), group); + if (sharedNodes.size() > 1) { + auto *scn = new SharedCommentNode(qmlType, sharedNodes.size(), group); scn->setLocation(doc.startLocation()); nodes.append(scn); docs.append(doc); -- cgit v1.2.1