aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGHLSLRuntime.cpp8
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp1
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp5
3 files changed, 5 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp
index 571ff53..585411b 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.cpp
+++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp
@@ -471,14 +471,6 @@ void CGHLSLRuntime::emitEntryFunction(const FunctionDecl *FD,
}
}
-void CGHLSLRuntime::setHLSLFunctionAttributes(const FunctionDecl *FD,
- llvm::Function *Fn) {
- if (FD->isInExportDeclContext()) {
- const StringRef ExportAttrKindStr = "hlsl.export";
- Fn->addFnAttr(ExportAttrKindStr);
- }
-}
-
static void gatherFunctions(SmallVectorImpl<Function *> &Fns, llvm::Module &M,
bool CtorOrDtor) {
const auto *GV =
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 13d0633..70a0979 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1267,7 +1267,6 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
if (FD->hasAttr<HLSLShaderAttr>()) {
CGM.getHLSLRuntime().emitEntryFunction(FD, Fn);
}
- CGM.getHLSLRuntime().setHLSLFunctionAttributes(FD, Fn);
}
EmitFunctionProlog(*CurFnInfo, CurFn, Args);
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())