================ @@ -145,25 +145,36 @@ bool isCtorOfSafePtr(const clang::FunctionDecl *F) { return isCtorOfRefCounted(F) || isCtorOfCheckedPtr(F); } -bool isSafePtrType(const clang::QualType T) { +template <typename Predicate> +static bool isPtrOfType(const clang::QualType T, Predicate Pred) { QualType type = T; while (!type.isNull()) { if (auto *elaboratedT = type->getAs<ElaboratedType>()) { type = elaboratedT->desugar(); continue; } if (auto *specialT = type->getAs<TemplateSpecializationType>()) { - if (auto *decl = specialT->getTemplateName().getAsTemplateDecl()) { - auto name = decl->getNameAsString(); - return isRefType(name) || isCheckedPtr(name); - } + if (auto *decl = specialT->getTemplateName().getAsTemplateDecl()) + return Pred(decl->getNameAsString()); return false; } return false; } return false; } +bool isSafePtrType(const clang::QualType T) { + return isPtrOfType( + T, [](auto Name) { return isRefType(Name) || isCheckedPtr(Name); }); +} + +bool isOwnerPtrType(const clang::QualType T) { + return isPtrOfType(T, [](auto Name) { + return isRefType(Name) || isCheckedPtr(Name) || Name == "unique_ptr" || + Name == "UniqueRef" || Name == "LazyUniqueRef"; ---------------- t-rasmud wrote:
Out of curiosity: Is this (`UniqueRef` and `LazyUniqueRef`) the exhaustive list of additional Webkit defined pointer owner types(I'm assuming)? https://github.com/llvm/llvm-project/pull/115594 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits