================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits