[all-commits] [llvm/llvm-project] 0f032f: [LifetimeSafety] Fix duplicate loan generation for...
Utkarsh Saxena via All-commits
all-commits at lists.llvm.org
Wed Sep 3 07:31:21 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0f032f1925389394802a86318ebc51b5e83f3b97
https://github.com/llvm/llvm-project/commit/0f032f1925389394802a86318ebc51b5e83f3b97
Author: Utkarsh Saxena <usx at google.com>
Date: 2025-09-03 (Wed, 03 Sep 2025)
Changed paths:
M clang/lib/Analysis/LifetimeSafety.cpp
M clang/lib/Sema/AnalysisBasedWarnings.cpp
M clang/test/Sema/warn-lifetime-safety-dataflow.cpp
M clang/unittests/Analysis/LifetimeSafetyTest.cpp
Log Message:
-----------
[LifetimeSafety] Fix duplicate loan generation for ImplicitCastExpr (#153661)
This PR fixes a bug in the lifetime safety analysis where `ImplicitCastExpr` nodes were causing duplicate loan generation. The changes:
1. Remove the recursive `Visit(ICE->getSubExpr())` call in `VisitImplicitCastExpr` to prevent duplicate processing of the same expression
2. Ensure the CFG build options are properly configured for lifetime safety analysis by moving the flag check earlier
3. Enhance the unit test infrastructure to properly handle multiple loans per variable
4. Add a test case that verifies implicit casts to const don't create duplicate loans
5. Add a test case for ternary operators with a FIXME note about origin propagation
These changes prevent the analysis from generating duplicate loans when expressions are wrapped in implicit casts, which improves the accuracy of the lifetime safety analysis.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list