@@ -174,19 +174,17 @@ class SemaHLSL : public SemaBase {
174174 bool handleResourceTypeAttr (QualType T, const ParsedAttr &AL);
175175
176176 template <typename T>
177- T *createSemanticAttr (const AttributeCommonInfo &ACI, Decl *TargetDecl,
177+ T *createSemanticAttr (const AttributeCommonInfo &ACI, NamedDecl *TargetDecl,
178178 std::optional<unsigned > Location) {
179- T *Attr = ::new (getASTContext ()) T (getASTContext (), ACI);
179+ T *Attr =
180+ ::new (getASTContext ()) T (getASTContext (), ACI, TargetDecl,
181+ Location.value_or (0 ), Location.has_value ());
180182
181- if (Attr->isSemanticIndexable ())
182- Attr->setSemanticIndex (Location ? *Location : 0 );
183- else if (Location.has_value ()) {
183+ if (!Attr->isSemanticIndexable () && Location.has_value ()) {
184184 Diag (Attr->getLocation (), diag::err_hlsl_semantic_indexing_not_supported)
185185 << Attr->getAttrName ()->getName ();
186186 return nullptr ;
187187 }
188-
189- Attr->setTargetDecl (TargetDecl);
190188 return Attr;
191189 }
192190
@@ -258,7 +256,7 @@ class SemaHLSL : public SemaBase {
258256 void checkSemanticAnnotation (FunctionDecl *EntryPoint, const Decl *Param,
259257 const HLSLSemanticAttr *SemanticAttr);
260258 HLSLSemanticAttr *createSemantic (const SemanticInfo &Semantic,
261- Decl *TargetDecl);
259+ DeclaratorDecl *TargetDecl);
262260 bool determineActiveSemanticOnScalar (FunctionDecl *FD, DeclaratorDecl *D,
263261 SemanticInfo &ActiveSemantic);
264262 bool determineActiveSemantic (FunctionDecl *FD, DeclaratorDecl *D,
0 commit comments