@@ -590,7 +590,6 @@ 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 ();
594593
595594 llvm::SmallVector<VarDecl *, 16 > GlobalsWithInit;
596595 GatherGlobalsWithInitializers (self->getASTContext ().getTranslationUnitDecl (),
@@ -706,7 +705,7 @@ void hlsl::DiagnoseTranslationUnit(clang::Sema *self) {
706705 << PatchConstantFunctionReturnIdx;
707706 }
708707 }
709-
708+ DXIL::ShaderKind EntrySK = shaderModel-> GetKind ();
710709 DXIL::NodeLaunchType NodeLaunchTy = DXIL::NodeLaunchType::Invalid;
711710 if (EntrySK == DXIL::ShaderKind::Library) {
712711 // For library, check if the exported function is entry with shader
@@ -734,12 +733,12 @@ void hlsl::DiagnoseTranslationUnit(clang::Sema *self) {
734733 Visitor.TraverseDecl (FD);
735734 }
736735
737- if (EntrySK == DXIL::ShaderKind::Library) {
736+ if (shaderModel-> GetKind () == DXIL::ShaderKind::Library) {
738737 for (VarDecl *VD : GlobalsWithInit) {
739738 DXIL::NodeLaunchType NodeLaunchTy = DXIL::NodeLaunchType::Invalid;
740739 HLSLReachableDiagnoseVisitor Visitor (
741- self, shaderModel, EntrySK , NodeLaunchTy, nullptr , DiagnosedCalls ,
742- DeclAvailabilityChecked, DiagnosedTypeLocs);
740+ self, shaderModel, shaderModel-> GetKind () , NodeLaunchTy, nullptr ,
741+ DiagnosedCalls, DeclAvailabilityChecked, DiagnosedTypeLocs);
743742 QualType QT = VD->getType ();
744743 if (const RecordType *RT = QT->getAs <RecordType>()) {
745744 RecordDecl *RD = RT->getDecl ();
@@ -749,4 +748,4 @@ void hlsl::DiagnoseTranslationUnit(clang::Sema *self) {
749748 }
750749 }
751750 }
752- }
751+ }
0 commit comments