mikecrowe marked 4 inline comments as done. mikecrowe added inline comments.
================ Comment at: clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp:384-397 + const auto StringDecl = type(hasUnqualifiedDesugaredType(recordType( + hasDeclaration(cxxRecordDecl(hasName("::std::basic_string")))))); + const auto StringExpr = expr(anyOf( + hasType(StringDecl), hasType(qualType(pointsTo(StringDecl))))); + + const auto StringCStrCallExpr = + cxxMemberCallExpr(on(StringExpr.bind("arg")), ---------------- PiotrZSL wrote: > mikecrowe wrote: > > PiotrZSL wrote: > > > constant construction of those marchers may be costly.. can be cache them > > > somehow in this object ? > > Good idea. Do you have any pointers to code that does this? I couldn't find > > any. > > > > The types involved all seem to be in the `internal::` namespace and > > presumably subject to change. Ideally, I'd put: > > ``` > > std::optional<SomeSortOfMatcherType> StringCStrCallExprMatcher; > > ``` > > in the class and then populate it here the first time lazily. Unfortunately > > I have no idea what type to use for `SomeSortOfMatcherType`. > `clang::ast_matchers::StatementMatcher<CXXMemberCallExpr>`, this is defined > as `using clang::ast_matchers::StatementMatcher = typedef > internal::Matcher<Stmt>`. > I would create it in class constructor as private member. Thanks for the pointer. It turns out that I need just `clang::ast_matchers::StatementMatcher`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D149280/new/ https://reviews.llvm.org/D149280 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits