================
@@ -299,6 +299,25 @@ bool RetainTypeChecker::isUnretained(const QualType QT,
bool ignoreARC) {
return RecordlessTypes.contains(QT.getTypePtr());
}
+const TypedefDecl *RetainTypeChecker::getCanonicalDecl(QualType QT) {
+ if (auto *TT = dyn_cast_or_null<TypedefType>(QT.getTypePtrOrNull())) {
+ if (auto *TD = dyn_cast<TypedefDecl>(TT->getDecl()))
+ return TD;
+ }
+ QT = QT.getCanonicalType();
+ auto PointeeQT = QT.getCanonicalType()->getPointeeType();
+ auto *PointeeType = PointeeQT.getTypePtrOrNull();
+ if (!PointeeType)
+ return nullptr;
+ auto *RD = dyn_cast<RecordType>(PointeeType);
+ if (!RD)
+ return nullptr;
+ auto It = CFPointees.find(RD);
+ if (It == CFPointees.end())
+ return nullptr;
+ return It->second;
----------------
steakhal wrote:
```suggestion
return CFPointees.lookup(RD);
```
https://github.com/llvm/llvm-project/pull/202724
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits