[clang] [LifetimeSafety] Suppress suggestion/inference for moved loans (PR #193899)
Zhijie Wang via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 24 00:47:01 PDT 2026
================
@@ -143,6 +143,10 @@ class LifetimeChecker {
AnnotationWarningsMap.try_emplace(MD, ReturnEsc->getReturnExpr());
};
for (LoanID LID : EscapedLoans) {
+ // Skip annotation suggestion for moved loans, as ownership transfer
+ // obscures the lifetime relationship (e.g., shared_ptr from unique_ptr).
+ if (MovedLoans.getMovedLoans(OEF).lookup(LID))
+ continue;
----------------
aeft wrote:
Since continue sits at the top of the loop, it also bypasses the `NoEscapeAttr` branch inside `CheckParam`, not just the `LifetimeBoundAttr` suggestion. Since NoEscape is a violation check rather than a suggestion, is skipping it for moved
loans intended?
https://github.com/llvm/llvm-project/pull/193899
More information about the cfe-commits
mailing list