[libc-commits] [clang-tools-extra] [libcxx] [clang] [libc] [compiler-rt] [flang] [llvm] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)
Bill Wendling via libc-commits
libc-commits at lists.llvm.org
Tue Dec 12 11:37:24 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)) {
----------------
bwendling wrote:
@rapidsna It would ignore that case, because it could have side-effects. But if it's the base pointer, it could be reused. I added a method in the visitor. I quickly tried the `CodeGenFunction::EmitLValueForField` method. Does it work with fields that aren't at the top level? At first glance, it doesn't appear to do that.
@efriedma-quic Okay. I changed it to look through the GEPs for the base pointer.
https://github.com/llvm/llvm-project/pull/73730
More information about the libc-commits
mailing list