================
@@ -44,7 +44,10 @@ internal::Matcher<Expr> callToGet(const
internal::Matcher<Decl> &OnClass) {
}
internal::Matcher<Decl> knownSmartptr() {
- return recordDecl(hasAnyName("::std::unique_ptr", "::std::shared_ptr"));
+ return recordDecl(
+ hasAnyName("::std::unique_ptr", "::std::shared_ptr"),
+ unless(anyOf(has(cxxMethodDecl(hasName("operator[]"))),
----------------
vbvictor wrote:
> i think we should just make sure methoddecl requirements in
> `QuacksLikeASmartptr` holds also for `std::{unique,shared}_ptr`, rather than
> looking for absence of `operator[]` (as we're actually not interested in lack
> of `operator[]` but existence of `operator{*,->}`).
+1 here, also, if we introduce such requirements for `knownSmartptr`, maybe it
is possible to completely remove `knownSmarptr` from
`registerMatchersForGetArrowStart` function so that we don't need to modify
`knownSmarptr` at all.
https://github.com/llvm/llvm-project/pull/141092
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits