[clang] [HLSL] Update type for `out` arguments only for dependent params types (PR #163832)
Tex Riddell via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 16 11:50:14 PDT 2025
================
@@ -765,10 +765,18 @@ static bool isRelevantAttr(Sema &S, const Decl *D, const Attr *A) {
static void instantiateDependentHLSLParamModifierAttr(
Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs,
- const HLSLParamModifierAttr *Attr, Decl *New) {
- ParmVarDecl *P = cast<ParmVarDecl>(New);
- P->addAttr(Attr->clone(S.getASTContext()));
- P->setType(S.HLSL().getInoutParameterType(P->getType()));
+ const HLSLParamModifierAttr *Attr, const Decl *Old, Decl *New) {
+ ParmVarDecl *NewParm = cast<ParmVarDecl>(New);
+ NewParm->addAttr(Attr->clone(S.getASTContext()));
+
+ const Type *OldParmTy = cast<ParmVarDecl>(Old)->getType().getTypePtr();
+ if (OldParmTy->isDependentType())
+ NewParm->setType(S.HLSL().getInoutParameterType(NewParm->getType()));
----------------
tex3d wrote:
Although I'm not as familiar with the code here as some others, from the context, I find it unexpected that a function called during a particular attribute instantiation might change the type of the `NewParm` Decl passed in.
Could there be a more appropriate place to update the type?
https://github.com/llvm/llvm-project/pull/163832
More information about the cfe-commits
mailing list