[clang] [Clang][counted_by] Refactor __builtin_dynamic_object_size on FAMs (PR #122198)
Bill Wendling via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 8 16:19:49 PST 2025
bwendling wrote:
Howdy!
This is essentially a complete rewrite of 00b6d032a22196bc14e4e30e413c040eb1b65da4. The original was overly complex and fragile. The main difference with this PR is basing the calculations off of the already emitted `Expr` instead of doing it within this function. It allows the Visitor to skip past pretty much everything to find the first `MemberExpr`. Note, we don't perform the calculation on the whole struct (i.e. `__bdos(ptr)`) due to issues with GCC compatibility, so the Visitor isn't concerned about any other `Expr` type but a `MemberExpr`.
The testcase changes are pretty large, but I visually reviewed the changes and ran the resulting code and it worked produced the expected results. (It even uncovered a bug! :-D)
Please take a look and let me know any issues you have. It's mostly an NFC patch, but it's so large and invasive that I can't really mark it as such.
https://github.com/llvm/llvm-project/pull/122198
More information about the cfe-commits
mailing list