[clang] [HLSL] Change default linkage of HLSL functions and groupshared variables (v2) (PR #95331)
Helena Kotas via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 1 15:23:57 PDT 2024
================
@@ -353,6 +353,23 @@ llvm::Value *CGHLSLRuntime::emitInputSemantic(IRBuilder<> &B,
return nullptr;
}
+void CGHLSLRuntime::emitFunctionProlog(const FunctionDecl *FD,
+ llvm::Function *Fn) {
+ if (!FD || !Fn)
+ return;
+
+ if (FD->hasAttr<HLSLShaderAttr>()) {
+ emitEntryFunction(FD, Fn);
+ } else {
+ // HLSL functions declared in the current translation unit without
+ // body have external linkage by default.
+ if (!FD->isDefined())
+ Fn->setLinkage(GlobalValue::ExternalLinkage);
+
+ // FIXME: also set external linkage on exported functions
----------------
hekota wrote:
I have mentioned them in the PR description.
https://github.com/llvm/llvm-project/pull/95331
More information about the cfe-commits
mailing list