================
@@ -396,14 +393,16 @@ void OriginManager::collectMissingOrigins(Stmt 
&FunctionBody,
   Collector.TraverseStmt(const_cast<Stmt *>(&FunctionBody));
 }
 
-void OriginManager::collectLifetimeAnnotatedOriginTypes(
-    const AnalysisDeclContext &AC) {
+void OriginManager::collectLifetimeAnnotatedOriginTypes(const CFG &Cfg) {
+  // The CFG has every evaluated statement as an element, including the
+  // constructor initializers and the default member initializers they use (see
+  // setLifetimeSafetyCFGBuildOptions), so these are the calls the facts are
+  // generated for.
   LifetimeAnnotatedOriginTypeCollector 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 (const CFGBlock *Block : Cfg)
----------------
Xazax-hun wrote:

Hmm, not sure if that worth it because post order walk also has its own cost 
and we probably very rarely benefit from not visiting dead branches in this 
single pass algorithm. With the facts they can influence each other, it matters 
which fact comes before the other. With this collection the result should be 
order independent. 

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

Reply via email to