================
@@ -3005,6 +3010,51 @@ void clang::sema::AnalysisBasedWarnings::IssueWarnings(
     LifetimeSafetyTUAnalysis(S, TU, LSStats);
 }
 
+void clang::sema::AnalysisBasedWarnings::
+    IssueLifetimeSafetyWarningsForImplicitFunction(const Decl *D) {
+  if (!D || !D->getBody())
+    return;
+  // TU-end analysis reaches such definitions via its own call-graph walk; only
+  // handle the per-function mode here. The remaining guards mirror
+  // IssueWarnings.
+  if (S.getLangOpts().EnableLifetimeSafetyTUAnalysis ||
+      !S.getLangOpts().CPlusPlus || !lifetimes::IsLifetimeSafetyEnabled(S, D))
+    return;
----------------
usx95 wrote:

I think `lifetimes::IsLifetimeSafetyEnabled` alone should be able to handle 
this. E.g. if `EnableLifetimeSafetyTUAnalysis` is true, it returns true only 
for TUDecls. Also takes care of language enablement.

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

Reply via email to