diff options
author | Steven Perron <stevenperron@google.com> | 2025-06-16 16:44:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-16 16:44:55 -0400 |
commit | a027eb4472ee8fa504c98bef655cac8c8bfe333a (patch) | |
tree | 834a81f56e819d9462e13e5b38db3e547c92da1b /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 34be09ad731d631d7b950a334cfe25673ebe5519 (diff) | |
download | llvm-a027eb4472ee8fa504c98bef655cac8c8bfe333a.zip llvm-a027eb4472ee8fa504c98bef655cac8c8bfe333a.tar.gz llvm-a027eb4472ee8fa504c98bef655cac8c8bfe333a.tar.bz2 |
[HLSL] Use hidden visibility for external linkage. (#140292)
Implements
https://github.com/llvm/wg-hlsl/blob/main/proposals/0026-symbol-visibility.md.
The change is to stop using the `hlsl.export` attribute. Instead,
symbols with "program linkage" in HLSL will have export linkage with
default visibility, and symbols with "external linkage" in HLSL will
have export linkage with hidden visibility.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index c036902..06c0e1f 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1666,6 +1666,11 @@ void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV, return; } + if (Context.getLangOpts().HLSL && !D->isInExportDeclContext()) { + GV->setVisibility(llvm::GlobalValue::HiddenVisibility); + return; + } + if (GV->hasDLLExportStorageClass() || GV->hasDLLImportStorageClass()) { // Reject incompatible dlllstorage and visibility annotations. if (!LV.isVisibilityExplicit()) |