================
@@ -110,6 +110,50 @@ class RetainPtrSafetyModel : public PtrRefSafetyModel {
RetainTypeChecker *retainTypeChecker() const override { return &RTC; }
};
+static std::optional<bool> isCanBorrowType(QualType T) {
+ auto *Record = T->getAsCXXRecordDecl();
+ if (!Record)
+ return false;
+ return isBorrowable(Record);
+}
+
+static bool isSameRecord(QualType A, QualType B) {
+ auto *RecordA = A->getAsCXXRecordDecl();
+ auto *RecordB = B->getAsCXXRecordDecl();
+ return RecordA && RecordB &&
+ RecordA->getCanonicalDecl() == RecordB->getCanonicalDecl();
+}
+
+static bool hasMemberThatPointsTo(QualType ViewType, QualType CanBorrowType,
+ unsigned Depth = 0) {
+ if (ViewType.isNull() || CanBorrowType.isNull())
+ return false;
+ if (Depth > 4)
----------------
rniwa wrote:
This seems rather arbitrary. Why should we return true when the depth is more
than 4?
https://github.com/llvm/llvm-project/pull/229495
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits