[libcxx-commits] [libc] [compiler-rt] [clang] [clang-tools-extra] [llvm] [flang] [libcxx] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

John McCall via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 14 23:09:46 PST 2023


================
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E,
       ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true);
     else
       ArrayLV = EmitLValue(Array);
+
     auto *Idx = EmitIdxAfterBase(/*Promote*/true);
 
+    if (SanOpts.has(SanitizerKind::ArrayBounds)) {
----------------
rjmccall wrote:

Can we not just reverse the member access to get back to the root of the `counted_by` path?  Presumably the root of the `counted_by` path for a field is always the non-transparent context of the field.  This should always be at a constant offset from the address point of the field — there's no such thing as an anonymous array.  Or am I misunderstanding something important about the constraints on `counted_by` paths?

https://github.com/llvm/llvm-project/pull/73730


More information about the libcxx-commits mailing list