================
@@ -1239,9 +1239,9 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, 
QualType RetTy,
   if (getLangOpts().OpenMP && CurCodeDecl)
     CGM.getOpenMPRuntime().emitFunctionProlog(*this, CurCodeDecl);
 
-  if (FD && getLangOpts().HLSL) {
+  if (getLangOpts().HLSL) {
     // Handle emitting HLSL entry functions.
-    if (FD->hasAttr<HLSLShaderAttr>()) {
+    if (FD && FD->hasAttr<HLSLShaderAttr>()) {
       CGM.getHLSLRuntime().emitEntryFunction(FD, Fn);
     }
     CGM.getHLSLRuntime().setHLSLFunctionAttributes(FD, Fn);
----------------
damyanp wrote:

Maybe not for this change, but a bit of me is wondering if the two 
CGHLSLRuntime functions emitEntryFunction and setHLSLFunctionAttributes should 
be somewhat combined so that we end up with something like:

```c++
if (getLangOpts().HLSL)
    CGM.getHLSLRuntime().emitFunctionProlog(FD, Fn);
```

Similar to how this is encapsulated for OpenMP above.  That way we get more of 
the HLSL-specific stuff in CGHLSLRuntime.cpp.

https://github.com/llvm/llvm-project/pull/106588
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to