================
@@ -468,6 +468,20 @@ void FactsGenerator::handlePointerArithmetic(const
BinaryOperator *BO) {
}
void FactsGenerator::VisitBinaryOperator(const BinaryOperator *BO) {
+ if (BO->getOpcode() == BO_PtrMemD || BO->getOpcode() == BO_PtrMemI) {
+ // `obj.*pm` / `objptr->*pm` names a member of the object, so a borrow of
it
+ // borrows the object; flow the object's origin into the result. For `.*`
+ // the object is the LHS; for `->*` it is the LHS pointer's pointee.
+ OriginList *Dst = getOriginsList(*BO);
+ OriginList *ObjSrc =
+ BO->getOpcode() == BO_PtrMemD
+ ? getOriginsList(*BO->getLHS())
+ : getRValueOrigins(BO->getLHS(), getOriginsList(*BO->getLHS()));
+ if (Dst && ObjSrc && Dst->getLength() == ObjSrc->getLength())
----------------
NeKon69 wrote:
I am a bit unsure about this check, is it actually needed? When will the
mismatch happen?
https://github.com/llvm/llvm-project/pull/204612
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits