[clang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 7 13:52:37 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)) {
----------------
efriedma-quic wrote:

If you have `p->p->p->a.b.c.d.e[index]`, the count is something like `p->p->p->a.b.c.d.count`.  So you just use `p->p->p->a.b.c.d` as the base, GEP from there to "e" and "count".



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


More information about the cfe-commits mailing list