================ @@ -118,6 +118,26 @@ bool isCtorOfRefCounted(const clang::FunctionDecl *F) { || FunctionName == "Identifier"; } +bool isReturnValueRefCounted(const clang::FunctionDecl *F) { + assert(F); + auto *type = F->getReturnType().getTypePtrOrNull(); + while (type) { + if (auto *elaboratedT = dyn_cast<ElaboratedType>(type)) { + type = elaboratedT->desugar().getTypePtrOrNull(); + continue; + } + if (auto *specialT = dyn_cast<TemplateSpecializationType>(type)) { ---------------- haoNoQ wrote:
`.getTypePtrOrNull()` can be dropped here as well: ```suggestion QualType type = F->getReturnType(); while (!type.isNull()) { if (auto *elaboratedT = type->getAs<ElaboratedType>()) { type = elaboratedT->desugar(); continue; } if (auto *specialT = type->getAs<TemplateSpecializationType>()) { ``` https://github.com/llvm/llvm-project/pull/81580 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits