[PATCH] D156624: [clang-tidy] Access checks not done classes derived of std::array
Piotr Zegar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 30 13:10:24 PDT 2023
PiotrZSL added a comment.
In D156624#4545170 <https://reviews.llvm.org/D156624#4545170>, @sousajo wrote:
> Good point, I cannot think of an _easy_ way to check it.
I think you can do something like this:
Finder->addMatcher(
cxxOperatorCallExpr(
hasOverloadedOperatorName("[]"),
calle(cxxMethodDecl(ofClass(cxxRecordDecl(hasName("::std::array")).bind("type"))))
hasArgument(1, expr().bind("index")))
.bind("expr"),
this);
In such case instead of checking argument passed to call, we check what operator we used and who provided it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156624/new/
https://reviews.llvm.org/D156624
More information about the cfe-commits
mailing list