@@ -590,6 +590,7 @@ void hlsl::DiagnoseTranslationUnit(clang::Sema *self) {
590590
591591 const auto *shaderModel =
592592 hlsl::ShaderModel::GetByName (self->getLangOpts ().HLSLProfile .c_str ());
593+ DXIL::ShaderKind EntrySK = shaderModel->GetKind ();
593594
594595 llvm::SmallVector<VarDecl *, 16 > GlobalsWithInit;
595596 GatherGlobalsWithInitializers (self->getASTContext ().getTranslationUnitDecl (),
@@ -706,7 +707,6 @@ void hlsl::DiagnoseTranslationUnit(clang::Sema *self) {
706707 }
707708 }
708709
709- DXIL::ShaderKind EntrySK = shaderModel->GetKind ();
710710 DXIL::NodeLaunchType NodeLaunchTy = DXIL::NodeLaunchType::Invalid;
711711 if (EntrySK == DXIL::ShaderKind::Library) {
712712 // For library, check if the exported function is entry with shader
@@ -731,23 +731,25 @@ void hlsl::DiagnoseTranslationUnit(clang::Sema *self) {
731731 for (VarDecl *VD : InitGlobals)
732732 Visitor.TraverseDecl (VD);
733733 for (FunctionDecl *FD : callGraph.GetVisitedFunctions ())
734- Visitor.TraverseDecl (FD);
735-
734+ Visitor.TraverseDecl (FD);
735+ }
736+
737+ if (EntrySK == DXIL::ShaderKind::Library) {
736738 for (VarDecl *VD : GlobalsWithInit) {
737739 DXIL::NodeLaunchType NodeLaunchTy = DXIL::NodeLaunchType::Invalid;
738740 HLSLCallDiagnoseVisitor Visitor (self, shaderModel, EntrySK, NodeLaunchTy,
739- VD , DiagnosedCalls,
741+ nullptr , DiagnosedCalls,
740742 DeclAvailabilityChecked);
741743 if (InitListExpr *ILE = dyn_cast<InitListExpr>(VD->getInit ())) {
742744 if (auto RT = ILE->getType ()->getAs <RecordType>()) {
743745 if (const RecordDecl *RD = RT->getDecl ()) {
744- if (RD->getName () == " RaytracingPipelineConfig1" ){
746+ if (RD->getName () == " RaytracingPipelineConfig1" ) {
745747 Visitor.TraverseDecl (VD);
746748 }
747749 }
748750 }
749751 }
750752 break ;
751- }
753+ }
752754 }
753755}
0 commit comments