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
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to