================
@@ -372,6 +372,23 @@ void FactsGenerator::VisitUnaryOperator(const
UnaryOperator *UO) {
killAndFlowOrigin(*UO, *SubExpr);
return;
}
+ case UO_PreInc:
+ case UO_PostInc:
+ case UO_PreDec:
+ case UO_PostDec: {
+ // Incrementing/decrementing a pointer keeps it in the same allocation, so
+ // the result carries the operand's loans. The operand is always an lvalue;
+ // peel its storage origin when the result is a prvalue (post-inc/dec, or
+ // any form in C).
+ if (!UO->getType()->isPointerType())
+ return;
+ OriginList *SubList = getOriginsList(*UO->getSubExpr());
+ OriginList *Src = SubList && !UO->isGLValue() ? SubList->peelOuterOrigin()
+ : SubList;
----------------
NeKon69 wrote:
This is just my personal preference, but shouldn't we do something like this
instead?
```cpp
OriginList *Src = SubList && IsCMode ? SubList->peelOuterOrigin()
: SubList;
```
https://github.com/llvm/llvm-project/pull/204477
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits