aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorHelena Kotas <hekotas@microsoft.com>2024-08-13 11:09:36 -0700
committerGitHub <noreply@github.com>2024-08-13 11:09:36 -0700
commit2c8bd4a729a042ed823547ea0eacad429c50d7bf (patch)
tree4444878c14aecdca0b848d968c2aa1a520858598 /clang/lib/CodeGen/CodeGenFunction.cpp
parent661dda9df13c65ce021407bb726b558c7a414731 (diff)
downloadllvm-2c8bd4a729a042ed823547ea0eacad429c50d7bf.zip
llvm-2c8bd4a729a042ed823547ea0eacad429c50d7bf.tar.gz
llvm-2c8bd4a729a042ed823547ea0eacad429c50d7bf.tar.bz2
[HLSL] Mark exported functions with "hlsl.export" attribute (#102275)
Marks exported functions with `"hlsl.export"` attribute. This information will be later used by DXILFinalizeLinkage pass (coming soon) to determine which functions should have internal linkage in the final DXIL code. Related to #llvm/llvm-project#92071
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 7adc5a4..eff8c9f 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1228,9 +1228,13 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
if (getLangOpts().OpenMP && CurCodeDecl)
CGM.getOpenMPRuntime().emitFunctionProlog(*this, CurCodeDecl);
- // Handle emitting HLSL entry functions.
- if (D && D->hasAttr<HLSLShaderAttr>())
- CGM.getHLSLRuntime().emitEntryFunction(FD, Fn);
+ if (FD && getLangOpts().HLSL) {
+ // Handle emitting HLSL entry functions.
+ if (FD->hasAttr<HLSLShaderAttr>()) {
+ CGM.getHLSLRuntime().emitEntryFunction(FD, Fn);
+ }
+ CGM.getHLSLRuntime().setHLSLFunctionAttributes(FD, Fn);
+ }
EmitFunctionProlog(*CurFnInfo, CurFn, Args);