diff options
| author | Kashika Akhouri <akhourik@google.com> | 2025-11-21 18:51:21 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-21 18:51:21 +0530 |
| commit | 4fca7b05e397e381466d6943a56f8407349c7594 (patch) | |
| tree | 16f2cd521355302102274b04f7fc2151cdc848ab /lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py | |
| parent | d36e2b621fd9e3354cef00135ad0cb8923ae4269 (diff) | |
[LifetimeSafety] Detect expiry of loans to trivially destructed types (#168855)
Handling Trivially Destructed Types
This PR uses `AddLifetime` to handle expiry of loans to trivially
destructed types.
Example:
```cpp
int * trivial_uar(){
int *ptr;
int x = 1;
ptr = &x;
return ptr;
}
```
The CFG created now has an Expire Fact for trivially destructed types:
```
Function: trivial_uar
Block B2:
End of Block
Block B1:
Issue (0 (Path: x), ToOrigin: 0 (Expr: DeclRefExpr))
OriginFlow (Dest: 1 (Expr: UnaryOperator), Src: 0 (Expr: DeclRefExpr))
Use (2 (Decl: ptr), Write)
OriginFlow (Dest: 2 (Decl: ptr), Src: 1 (Expr: UnaryOperator))
Use (2 (Decl: ptr), Read)
OriginFlow (Dest: 3 (Expr: ImplicitCastExpr), Src: 2 (Decl: ptr))
Expire (0 (Path: x))
OriginEscapes (3 (Expr: ImplicitCastExpr))
End of Block
Block B0:
End of Block
```
This Expire Fact issues UAR and UAF warnings.
Fixes https://github.com/llvm/llvm-project/issues/162862
Diffstat (limited to 'lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py')
0 files changed, 0 insertions, 0 deletions
