[all-commits] [llvm/llvm-project] 9f35df: [libcxx] Remove empty ~__no_destroy

Vitaly Buka via All-commits all-commits at lists.llvm.org
Thu Apr 25 11:07:02 PDT 2024


  Branch: refs/heads/users/vitalybuka/spr/libcxx-avoid-__cxa_atexit-with-o0
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f35dfcea56c75d1700897ba664511702a75a6bb
      https://github.com/llvm/llvm-project/commit/9f35dfcea56c75d1700897ba664511702a75a6bb
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2024-04-25 (Thu, 25 Apr 2024)

  Changed paths:
    M libcxx/include/__utility/no_destroy.h
    A libcxx/test/libcxx/utilities/no_destroy.pass.cpp

  Log Message:
  -----------
  [libcxx] Remove empty ~__no_destroy

Primary motivation is that after #84651 msan will
complain if fields accessed after ~__no_destroy.

Previously msan assumed that __obj_ will have own
destructor, were we will poison the field, but it never
happened before.

After #84651 msan will complain on any field access
after `~__no_destroy`.

As is Msan does validate fields destruction order for
classes with trivial destructor.

Additionally empty destructor will register __cxa_atexit with -O0.
https://gcc.godbolt.org/z/hce587b65

We can not remove the destructor with union where
_Tp can have non-trivial destructor.

But we can remove destructor if we use in-place
new instead of union.
https://gcc.godbolt.org/z/Yqxx57eEd - empty even with -O0.

Reviewers: #reviewers-libcxx

Pull Request: https://github.com/llvm/llvm-project/pull/89882


  Commit: 7a65205fcb200819e4d9d7a09b4f5c18a2c2e07d
      https://github.com/llvm/llvm-project/commit/7a65205fcb200819e4d9d7a09b4f5c18a2c2e07d
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2024-04-25 (Thu, 25 Apr 2024)

  Changed paths:
    M libcxx/include/__utility/no_destroy.h

  Log Message:
  -----------
  Remove "unsigned"


  Commit: a7d789a17767e2f63c0a4773599d97e6759ec381
      https://github.com/llvm/llvm-project/commit/a7d789a17767e2f63c0a4773599d97e6759ec381
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2024-04-25 (Thu, 25 Apr 2024)

  Changed paths:
    M libcxx/include/__utility/no_destroy.h
    M libcxx/test/libcxx/utilities/no_destroy.pass.cpp

  Log Message:
  -----------
  Move field initialized and add constinit test


  Commit: 36bffcebfeaff3207ad3a41d12b6bb44c2bc7dc8
      https://github.com/llvm/llvm-project/commit/36bffcebfeaff3207ad3a41d12b6bb44c2bc7dc8
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2024-04-25 (Thu, 25 Apr 2024)

  Changed paths:
    M libcxx/test/libcxx/utilities/no_destroy.pass.cpp

  Log Message:
  -----------
  Inline test


  Commit: 430f9d87d16ca4791b83db2ab09de1aa0ba848c0
      https://github.com/llvm/llvm-project/commit/430f9d87d16ca4791b83db2ab09de1aa0ba848c0
  Author: Vitaly Buka <vitalybuka at google.com>
  Date:   2024-04-25 (Thu, 25 Apr 2024)

  Changed paths:
    M libcxx/test/libcxx/utilities/no_destroy.pass.cpp

  Log Message:
  -----------
  reorder test


Compare: https://github.com/llvm/llvm-project/compare/1161ecf5b669...430f9d87d16c

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list