================
@@ -255,6 +255,26 @@ template <typename T> static bool
isRecordWithAttr(QualType Type) {
bool isGslPointerType(QualType QT) { return isRecordWithAttr<PointerAttr>(QT);
}
bool isGslOwnerType(QualType QT) { return isRecordWithAttr<OwnerAttr>(QT); }
+static bool isStdUniquePtr(const CXXRecordDecl *RD) {
+ if (!RD || !RD->isInStdNamespace())
+ return false;
+
+ StringRef Name;
+ if (const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(RD))
+ Name = CTSD->getSpecializedTemplate()->getName();
+ else if (RD->getIdentifier())
+ Name = RD->getName();
+ else
+ return false;
+
+ return Name == "unique_ptr";
+}
+
+bool isUniquePtrRelease(const CXXMethodDecl *MD) {
+ return MD && MD->getIdentifier() && MD->getName() == "release" &&
----------------
Xazax-hun wrote:
We have null checks both here and at the call site, should this take a
reference instead?
https://github.com/llvm/llvm-project/pull/180230
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits