[clang] [HLSL] (DRAFT) Another way to implement #92071: [HLSL] Default linkage of HLSL function should be internal (PR #95331)
Greg Roth via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 24 13:11:40 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
----------------
pow2clk wrote:
I don't know if you want to mention patch constant functions here as well. They will need to be external in the end as well.
https://github.com/llvm/llvm-project/pull/95331
More information about the cfe-commits
mailing list