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

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 29 12:40:52 PST 2023


bwendling wrote:

> I'd like to see a few tests involving multiple arrows in the same expression. (If my understanding is correct, you want to cut the recursion when you see an arrow member.)

Correct. I'll add the code and some testcases.

> Looking at the code again, I guess FindCountedByField doesn't explicitly compute the base expression, so maybe that doesn't work as-is. But tying the recursion over the expression to the recursion over the record would be a good way to ensure the base expression is actually the expression you want. The way the code is currently written seems to strongly assume that if there's a relevant counted_by field, it's usable no matter how the expression is actually structured.

There are Sema checks to ensure that `counted_by` is applied only to flexible array members. I am crossing my fingers here that the `Base` expression is well behaved. But I agree that tying the two will make for a stronger check here. Let me work on that.

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


More information about the cfe-commits mailing list