From 643aaa13d2c6e0c4994437aa9fba6716787608ce Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 7 Jul 2023 14:26:37 -0700 Subject: Make DeclRefBase a Val, and DeclRef a helper class. (#2967) * Make DeclRefBase a Val, and DeclRef a helper class. * Fixes. * Workaround gcc parser issue. * Revert NodeOperand change. * Fix. * Fix clang incomplete class complains. * Fix code review. * Small cleanups and improvements. --------- Co-authored-by: Yong He --- source/slang/slang-parameter-binding.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source/slang/slang-parameter-binding.cpp') diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp index 4679e58c3..e22bc0597 100644 --- a/source/slang/slang-parameter-binding.cpp +++ b/source/slang/slang-parameter-binding.cpp @@ -960,7 +960,7 @@ static void addExplicitParameterBindings_HLSL( // TODO: warning here! } - addExplicitParameterBinding(context, parameterInfo, varDecl, semanticInfo, count); + addExplicitParameterBinding(context, parameterInfo, varDecl.getDecl(), semanticInfo, count); } } @@ -1048,7 +1048,7 @@ static void addExplicitParameterBindings_GLSL( auto count = resInfo->count; semanticInfo.kind = kind; - addExplicitParameterBinding(context, parameterInfo, varDecl, semanticInfo, count); + addExplicitParameterBinding(context, parameterInfo, varDecl.getDecl(), semanticInfo, count); return; } @@ -1071,7 +1071,7 @@ static void addExplicitParameterBindings_GLSL( // // TODO(JS): I suppose there is some ambiguity here, because if we did a semantic lookup, and it didn't have a vulkanKind // or didn't parse correctly we wouldn't issue this message. - getSink(context)->diagnose(varDecl, Diagnostics::cannotInferVulkanBindingWithoutRegisterModifier, varDecl); + getSink(context)->diagnose(varDecl.getDecl(), Diagnostics::cannotInferVulkanBindingWithoutRegisterModifier, varDecl); return; } @@ -1098,7 +1098,7 @@ static void addExplicitParameterBindings_GLSL( { // If we made it here, there are shift options, but there isn't one for the space/kind specified // That could be a problem and unexpected, so issue a warning - getSink(context)->diagnose(varDecl, Diagnostics::hlslToVulkanMappingNotFound, varDecl); + getSink(context)->diagnose(varDecl.getDecl(), Diagnostics::hlslToVulkanMappingNotFound, varDecl); return; } @@ -1111,7 +1111,7 @@ static void addExplicitParameterBindings_GLSL( const LayoutSize count = resInfo->count; - addExplicitParameterBinding(context, parameterInfo, varDecl, semanticInfo, count); + addExplicitParameterBinding(context, parameterInfo, varDecl.getDecl(), semanticInfo, count); } // Given a single parameter, collect whatever information we have on @@ -2071,7 +2071,7 @@ static RefPtr processEntryPointVaryingParameter( auto fieldResInfo = fieldVarLayout->FindResourceInfo(kind); if( !fieldResInfo ) { - if(!firstImplicit) firstImplicit = field; + if(!firstImplicit) firstImplicit = field.getDecl(); // In the implicit-layout case, we assign the field // the next available offset after the fields that @@ -2083,7 +2083,7 @@ static RefPtr processEntryPointVaryingParameter( } else { - if(!firstExplicit) firstExplicit = field; + if(!firstExplicit) firstExplicit = field.getDecl(); // In the explicit case, the field already has offset // information, and we just need to update the computed @@ -2108,7 +2108,7 @@ static RefPtr processEntryPointVaryingParameter( if( auto concreteType = findGlobalGenericSpecializationArg( layoutContext, - globalGenericParamDecl) ) + globalGenericParamDecl.getDecl()) ) { // If we know what concrete type has been used to specialize // the global generic type parameter, then we should use @@ -2134,7 +2134,7 @@ static RefPtr processEntryPointVaryingParameter( // to the generic type, since we can't know how many "slots" // of varying input/output it would consume. // - return createTypeLayoutForGlobalGenericTypeParam(layoutContext, type, globalGenericParamDecl); + return createTypeLayoutForGlobalGenericTypeParam(layoutContext, type, globalGenericParamDecl.getDecl()); } } else if (auto associatedTypeParam = declRef.as()) @@ -2726,7 +2726,7 @@ static RefPtr collectEntryPointParameters( // Any generic specialization applied to the entry-point function // must also be applied to its parameters. - paramDeclRef.substitutions = entryPointFuncDeclRef.substitutions; + paramDeclRef = context->getASTBuilder()->getSpecializedDeclRef(paramDeclRef.getDecl(), entryPointFuncDeclRef.getSubst()); // When computing layout for an entry-point parameter, // we want to make sure that the layout context has access @@ -3782,7 +3782,7 @@ RefPtr generateParameterBindings( if( varLayout->typeLayout->FindResourceInfo(LayoutResourceKind::Uniform) ) { needDefaultConstantBuffer = true; - diagnoseGlobalUniform(&sharedContext, varLayout->varDecl); + diagnoseGlobalUniform(&sharedContext, varLayout->varDecl.getDecl()); } } } -- cgit v1.2.3