================
@@ -818,6 +821,33 @@ bool 
SemaHLSL::determineActiveSemanticOnScalar(FunctionDecl *FD,
 
   checkSemanticAnnotation(FD, D, A);
   FD->addAttr(A);
+
+  unsigned Location = ActiveSemantic.Index.value_or(0);
+
+  const ConstantArrayType *AT = dyn_cast<ConstantArrayType>(D->getType());
+  unsigned ElementCount = AT ? AT->getZExtSize() : 1;
+  ActiveSemantic.Index = Location + ElementCount;
+
+  Twine BaseName = Twine(ActiveSemantic.Semantic->getAttrName()->getName());
+  for (unsigned I = 0; I < ElementCount; ++I) {
+    Twine VariableName = BaseName.concat(Twine(Location + I));
+
+    auto It = ActiveInputSemantics.find(FD);
+    if (It == ActiveInputSemantics.end()) {
+      llvm::StringSet<> Set({VariableName.str()});
+      auto Item = std::make_pair(FD, std::move(Set));
+      ActiveInputSemantics.insert(std::move(Item));
+      continue;
+    }
+
+    auto [_, Inserted] = ActiveInputSemantics[FD].insert(VariableName.str());
----------------
s-perron wrote:

Is looking for the variable name good enough? If you have something at index 0 
and array size 3, and a scalar at index 1. It that not overlap?

https://github.com/llvm/llvm-project/pull/153424
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to