[all-commits] [llvm/llvm-project] bc09ec: [CodeGen] Revamp counted_by calculations (#70606)

Bill Wendling via All-commits all-commits at lists.llvm.org
Thu Nov 9 10:18:40 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bc09ec696209b3aea74d49767b15c2f34e363933
      https://github.com/llvm/llvm-project/commit/bc09ec696209b3aea74d49767b15c2f34e363933
  Author: Bill Wendling <5993918+bwendling at users.noreply.github.com>
  Date:   2023-11-09 (Thu, 09 Nov 2023)

  Changed paths:
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    M clang/test/CodeGen/attr-counted-by.c

  Log Message:
  -----------
  [CodeGen] Revamp counted_by calculations (#70606)

Break down the counted_by calculations so that they correctly handle
anonymous structs, which are specified internally as IndirectFieldDecls.

Improves the calculation of __bdos on a different field member in the struct.
And also improves support for __bdos in an index into the FAM. If the index
is further out than the length of the FAM, then we return __bdos's "can't
determine the size" value (zero or negative one, depending on type).

Also simplify the code to use helper methods to get the field referenced
by counted_by and the flexible array member itself, which also had some
issues with FAMs in sub-structs.




More information about the All-commits mailing list