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

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 12:39:02 PST 2023


bwendling wrote:

The problem with adding the code to `CodeGenFunction::EmitArraySubscriptExpr` is that we need to emit the counted_by "count" for more than just an `ArraySubscriptExpr`. Where `ExprLValueMap` is placed catches all of the expressions we're interested in. We're doing something similar to `LocalDeclMap`.

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

```
   // Towards end of method.
   if (Sanitizing ArrayBounds) {
       if (Array is a flexible array member with a counted_by attribute)
          Emit the bounds checking here.
   }
```

I'll give it a shot.

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


More information about the cfe-commits mailing list