[clang] [LifetimeSafety] Suggest lifetime annotations (PR #169767)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 4 23:51:25 PST 2025
================
@@ -34,46 +34,110 @@ struct AccessPath {
AccessPath(const clang::ValueDecl *D) : D(D) {}
};
-/// Information about a single borrow, or "Loan". A loan is created when a
-/// reference or pointer is created.
-struct Loan {
+/// An abstract base class for a single borrow, or "Loan".
+class Loan {
/// TODO: Represent opaque loans.
/// TODO: Represent nullptr: loans to no path. Accessing it UB! Currently it
/// is represented as empty LoanSet
- LoanID ID;
+public:
+ enum class Kind : uint8_t {
+ /// A regular borrow of a variable within the function that has a path and
+ /// can expire.
+ Borrow,
----------------
usx95 wrote:
Let's drop the mention of "borrows" from the analysis. It is already a very overloaded term in this domain and since we have been calling these "loans", let's us not mix these then.
Let's call them `PathLoan`
```cpp
/// A loan with an access path to a storage in memory.
Path,
```
Keeping Placeholder as it is fine to me.
https://github.com/llvm/llvm-project/pull/169767
More information about the cfe-commits
mailing list