[all-commits] [llvm/llvm-project] cd05ad: Add a "don't override" mapping for -fvisibility-fr...

bd1976bris via All-commits all-commits at lists.llvm.org
Fri Jan 19 13:57:52 PST 2024


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

  Changed paths:
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Basic/LangOptions.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/test/CodeGenCXX/visibility-dllstorageclass.cpp
    M clang/test/Driver/visibility-dllstorageclass.c

  Log Message:
  -----------
  Add a "don't override" mapping for -fvisibility-from-dllstorageclass (#74629)

`-fvisibility-from-dllstorageclass` allows for overriding the visibility
of globals from their DLL storage class. The visibility to apply can be
customised for the different classes of globals via a set of dependent
options that specify the mapping values:
- `-fvisibility-dllexport=<value>`
- `-fvisibility-nodllstorageclass=<value>`
- `-fvisibility-externs-dllimport=<value>`
- `-fvisibility-externs-nodllstorageclass=<value>` 

Currently, one of the existing LLVM visibilities, `hidden`, `protected`,
`default`, can be used as a mapping value. This change adds a new
mapping value: `keep`, which specifies that the visibility should not be
overridden for that class of globals. The behaviour of
`-fvisibility-from-dllstorageclass` is otherwise unchanged and existing
uses of this set of options will be unaffected.

The background to this change is that currently the PS4 and PS5
compilers effectively ignore visibility - dllimport/export is the
supported method for export control in C/C++ source code. Now, we would
like to support visibility attributes and options in our frontend, in
addition to dllimport/export. To support this, we will override the
visibility of globals with explicit dllimport/export annotations but use
the `keep` setting for globals which do not have an explicit
dllimport/export.

There are also some minor improvements to the existing options:
- Make the `LANGOPS` `BENIGN` as they don't involve the AST.
- Correct/clarify the help text for the options.




More information about the All-commits mailing list