================
@@ -232,8 +289,28 @@ const Origin &OriginManager::getOrigin(OriginID ID) const {
 
 void OriginManager::collectMissingOrigins(Stmt &FunctionBody,
                                           LifetimeSafetyStats &LSStats) {
-  MissingOriginCollector Collector(this->ExprToList, LSStats);
+  MissingOriginCollector Collector(this->ExprToList, *this, LSStats);
   Collector.TraverseStmt(const_cast<Stmt *>(&FunctionBody));
 }
 
+void OriginManager::collectLifetimeboundOriginTypes(
+    const AnalysisDeclContext &AC) {
+  LifetimeboundOriginTypeCollector Collector;
+  if (Stmt *Body = AC.getBody())
+    Collector.TraverseStmt(Body);
+  if (const auto *CD = dyn_cast<CXXConstructorDecl>(AC.getDecl()))
+    for (const auto *Init : CD->inits())
+      Collector.TraverseStmt(Init->getInit());
+  for (QualType QT : Collector.getCollectedTypes())
+    registerLifetimeboundOriginType(QT);
+}
+
+void OriginManager::registerLifetimeboundOriginType(QualType QT) {
+  if (!QT->getAsCXXRecordDecl() || hasOrigins(QT))
+    return;
+
+  LifetimeboundOriginTypes.insert(
+      QT->getCanonicalTypeUnqualified().getTypePtr());
----------------
aeft wrote:

The result should be the same. I updated to `getCanonicalType`.

https://github.com/llvm/llvm-project/blob/e485a5d36e00e69e1b721b81a41be300662729c5/clang/include/clang/AST/TypeBase.h#L969-L973

https://github.com/llvm/llvm-project/pull/187917
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to