bwendling wrote:

> And ideally, the recursive visit should list those expressions explicitly, 
> instead aborting on ones we know are bad.

I'm sorry, I don't understand what you're talking about here. The whole point 
of the recursive visit is to find a suitable base pointer. If we run across any 
undesirable expressions (e.g. pointer arithmetic) then we return `nullptr` to 
signify this. What do you mean we should list those expressions explicitly?

> So you don't recurse; you just look for that exact AST structure.

Looking for the exact AST structure is what I'm trying to accomplish with 
`ExprLValueMap`. Even in `EmitArraySubscriptExpr`, I'll still have to crawl up 
the `MemberExpr` to find a suitable base pointer for accessing the `counted_by` 
field. The information about what LValue was generated for that base pointer is 
no longer available to us. It's not so bad if the base pointer is a simple 
`DeclRefExpr`, but if it's a `MemberExpr`, things get more complicated. If I 
can verify that the `MemberExpr` has no side-effects, then I can call the 
`EmitMemberExpr` method. This will most likely duplicate code, but not a huge 
deal. However, if I *can* reusing the `LValue` from the base `MemberExpr` with 
side-effects, then I can still emit the `counted_by` check, since I won't be 
re-generating the side-effects.

https://github.com/llvm/llvm-project/pull/73730
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to