[all-commits] [llvm/llvm-project] 27ce26: [Sema] Add `-fvisibility-global-new-delete=` optio...

bd1976bris via All-commits all-commits at lists.llvm.org
Mon Jan 22 04:37:23 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 27ce26b06655cfece3d54b30e442ef93d3e78ac7
      https://github.com/llvm/llvm-project/commit/27ce26b06655cfece3d54b30e442ef93d3e78ac7
  Author: bd1976bris <bd1976llvm at gmail.com>
  Date:   2024-01-22 (Mon, 22 Jan 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Basic/LangOptions.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/lib/Driver/ToolChains/PS4CPU.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    A clang/test/CodeGenCXX/visibility-global-new-delete.cpp
    A clang/test/Driver/visibility-global-new-delete.cl

  Log Message:
  -----------
  [Sema] Add `-fvisibility-global-new-delete=` option (#75364)

[Sema] Add `-fvisibility-global-new-delete=` option (#75364)

By default the implicitly declared replaceable global new and delete
operators are given a default visibility attribute. Previous work, see:
https://reviews.llvm.org/D53787, added
`-fvisibility-global-new-delete-hidden` to change this to a hidden
visibility attribute.

This change adds `-fvisibility-global-new-delete=` which controls
whether (or not) to add an implicit visibility attribute to the implicit
declarations for these functions, and what visibility that attribute
will specify. The option takes 4 values: `force-hidden`,
`force-protected`, `force-default` and `source`. Option values
`force-hidden`, `force-protected` and `force-default` assign hidden,
protected, and default visibilities respectively; the use of the term
force in the value names is designed to imply to a user that the semantics
of this option differ significantly from `-fvisibility=`. An option
value of `source` implies that no implicit attribute is added; without
the attribute the replaceable global new and delete operators behave
normally (like other functions) with respect to visibility attributes,
pragmas and options.

The motivation for the `source` value is to facilitate users who intend
to replace these functions either for a single linkage unit or a limited
set of linkage units. `-fvisibility-global-new-delete=source` can be
applied globally to the compilations in a build where the existing
`-fvisibility-global-new-delete-hidden` cannot, as it conflicts with a
common pattern where these functions are dynamically imported.

The existing `-fvisibility-global-new-delete-hidden` is now a deprecated
spelling of `-fvisibility-global-new-delete=force-hidden`

A release note has been added for these changes.

`-fvisibility-global-new-delete=source` will be set by default for PS5.
PS5 users that want the normal toolchain behaviour will be able to
supply `-fvisibility-global-new-delete=force-default`.




More information about the All-commits mailing list