[clang] [Clang] Fix 'counted_by' for nested struct pointers (PR #110497)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 4 15:34:55 PDT 2024


efriedma-quic wrote:

ast-dump for your example:

```
|   | `-CallExpr 0xcc44978 <col:25, col:59> 'unsigned long'
|   |   |-ImplicitCastExpr 0xcc44960 <col:25> 'unsigned long (*)(const void *, int)' <BuiltinFnToFnPtr>
|   |   | `-DeclRefExpr 0xcc448b8 <col:25> '<builtin fn type>' Function 0xcc446b0 '__builtin_dynamic_object_size' 'unsigned long (const void *, int)'
|   |   |-ImplicitCastExpr 0xcc449c0 <col:55> 'const void *' <BitCast>
|   |   | `-ImplicitCastExpr 0xcc449a8 <col:55> 'struct variable *' <LValueToRValue>
|   |   |   `-DeclRefExpr 0xcc448d8 <col:55> 'struct variable *' lvalue Var 0xcc41278 'v' 'struct variable *'
|   |   `-IntegerLiteral 0xcc448f8 <col:58> 'int' 0
```

I guess CodeGenFunction::emitFlexibleArrayMemberSize calls IgnoreParenImpCasts() which throws away the lvalue-to-rvalue.


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


More information about the cfe-commits mailing list