aaronpuchert wrote:
Something like `READ_ONCE` might be supported differently: suppose there is
actually a read, i.e. an lvalue-to-rvalue cast. We check those here:
```c++
void BuildLockset::VisitCastExpr(const CastExpr *CE) {
if (CE->getCastKind() != CK_LValueToRValue)
return;
checkAccess(CE->getSubExpr(), AK_Read);
}
```
Then `checkAccess` looks through `*`:
```c++
if (const auto *UO = dyn_cast<UnaryOperator>(Exp)) {
// For dereferences
if (UO->getOpcode() == UO_Deref)
checkPtAccess(FSet, UO->getSubExpr(), AK, POK);
return;
}
```
Then we only need to make sure that `checkPtAccess` can look through `&`, as
mentioned above. (Casts should already be unwrapped.) This might not even need
a new flag, it's just closing a gap in the existing analysis.
https://github.com/llvm/llvm-project/pull/123063
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits