[clang] [LifetimeSafety] Track origins through array subscript and array-to-pointer decay (PR #186902)
Utkarsh Saxena via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 17 03:47:43 PDT 2026
================
@@ -470,6 +474,16 @@ void FactsGenerator::VisitLambdaExpr(const LambdaExpr *LE) {
}
}
+void FactsGenerator::VisitArraySubscriptExpr(const ArraySubscriptExpr *ASE) {
----------------
usx95 wrote:
Can you please verify that these do not fire in practice. Maybe try to build LLVM using your head Clang and see if it fires.
I use the following cmake in a separate build directory:
```
cmake -G Ninja path/to/llvm-project/llvm \
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;" \ -DLLVM_ENABLE_ASSERTIONS=On \
-DCMAKE_C_FLAGS_RELEASE="-O3 -gmlt -UNDEBUG" \
-DCMAKE_CXX_FLAGS_RELEASE="-O3 -gmlt -UNDEBUG -Wlifetime-safety" \
-DCMAKE_C_COMPILER="/path/to/build/bin/clang" \
-DCMAKE_CXX_COMPILER="/path/to/build/bin/clang++" \
-DLLVM_USE_LINKER=lld -DLLVM_CCACHE_BUILD=1
```
`-Wlifetime-safety` might be noisy. You can try `-Wlifetime-safety-permissive` instead.
https://github.com/llvm/llvm-project/pull/186902
More information about the cfe-commits
mailing list