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

Bill Wendling via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 15 13:50:38 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:

Forcing the `count` to be in the top-level struct was more-or-less a compromise in how the `__counted_by` field is specified. It might be too restrictive, or not restrictive enough (depending on your point of view). I personally would prefer a different way of specifying where the `count` is, ですけど.... (My idea is to use a form of the "designated initializer" syntax (maybe with a way to specify a "relative path?" ... dunno).)

If supporting a FAM in a substructure is too hairy, I can remove that support until we work out the kinks. (I think GCC doesn't yet have support for this.)

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


More information about the libcxx-commits mailing list