cor3ntin wrote:
I agree with @erichkeane.
I think there is a much simpler design where we build the CountAttributedType
on first pass and only fill the expression on type completeness - Either by
having some dependent expression or by token stashing like we do for C++ (and
I'd prefer the token stashing approach).
I further agree that ultimately this probably needs to work in C++ (not because
C++ needs it but because C++ might consumes C headers and compiling in C++ mode
should hopefully not give you less safety).
I am concerned by the lack of tests here. I understand that you are trying to
limit the scope of each PR, but dependency propagation is not trivial, consider
for example
```cpp
struct S {
int* _attribute__((address_space(1))) __counted_by(z) x;
__typeof__(x) y;
int z;
};
```
I suspect this does not work for multiple reasons.
`VariablyModified` has a bunch of code to deal with all of that. And
`VariablyModified` types are not dependent in that they are never transformed
(except when transmuted to an non-variably modified - which is not actually a
transform. the element type is just wrapped in an array type without ever being
rewritten.
Which is also something you could do, e.g on first pass the type can be an
AttributedType over the underlying type, then changed to a CountAttributedType
over T, without transforming T (which can be arbitrarily complex thanks to
compound literal, expressions statements, typeof, etc)
Then `VariablyModified` exist both because the variableness of a type needs to
propagate AND because we need to handle it all over the place.
I don't think the motivation to use precious dependency bits is there for
`CountAttributedType`.
https://github.com/llvm/llvm-project/pull/212906
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits