efriedma-quic wrote:

If you do need a map for something, I'd prefer to make it as narrow as 
possible.  For example, I can imagine you could need to specifically look up 
the corresponding allocation for a CompoundLiteralExpr; that might make sense.  
I don't think we should need to look up arbitrary lvalues.  For 
__builtin_dynamic_object_size, we should support a limited set of expressions 
as the base.  (And ideally, the recursive visit should list those expressions 
explicitly, instead aborting on ones we know are bad.)

> But if I placed some code in EmitArraySubscriptExpr, I'm guessing your 
> suggestion is more-or-less this:

Not sure it goes at the end. But to restate more explicitly, if you have 
something like ArraySubscriptExpr(MemberExpr(StructBase), ArrayIndex), you emit 
StructBase, then you emit the addresses of the array member and the counted_by 
member, then you use that to emit a bounds-checked array access.  So you don't 
recurse; you just look for that exact AST structure.

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