https://github.com/zygoloid commented:

We've discussed this before, years ago. Previously, the sticking point was: how 
is LLVM going to know what the frontend considers the closest surrounding 
subobject to be? The LLVM type doesn't give you that information, and it seems 
like there's nowhere else that LLVM can get it from either, so this flag ends 
up not being useful and the best we can do is to give a conservatively-correct 
answer -- the complete object size if we want an upper bound, or 0 if we want a 
lower bound.

Clang does respect the "subobject" flag if it can symbolically evaluate the 
operand of `__builtin_object_size` sufficiently to determine which subobject is 
being referenced. Previously we've thought that that was the best we could do.

https://github.com/llvm/llvm-project/pull/78526
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to