================
@@ -366,6 +366,7 @@ void FactsGenerator::VisitBinaryOperator(const
BinaryOperator *BO) {
// result should have the same loans as the pointer operand.
if (BO->isCompoundAssignmentOp())
return;
+ handleUse(BO->getRHS());
----------------
Xazax-hun wrote:
I wonder if we need to generalize this. I think there are two ways for us to
consider an lvalue to be used:
1. The lvalue is passed to a function. You are already dealing with this in
`handleFunctionCall`
2. We convert an lvalue to an rvalue.
I think what you added here is a special case of `2`, and I wonder if we
actually want to emit a use for each LValue to RValue conversion to avoid false
positives.
That might also mean that we do not actually need to emit a use for
DeclRefExprs anymore?
So e.g.:
```
int &r = a;
```
Here `a` is not used if `r` is not used.
Similarly:
```
int *p = &foo + 3;
```
Here, `foo` is not really used unless we dereference `p`.
https://github.com/llvm/llvm-project/pull/180446
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits