================
@@ -3078,6 +3078,17 @@ static void emitAttributes(const RecordKeeper &Records,
raw_ostream &OS,
OS << " {\n";
+ // The generator puts the arguments for each attribute in the child
class,
+ // even if those are set in the inherited attribute class (in the TD
+ // file). This means I cannot access those from the parent class, and
have
+ // to do this weirdness. Maybe the generator should be changed to
+ // arguments are put in the class they are declared in inside the TD
file?
+ if (HLSLSemantic) {
+ OS << " if (SemanticExplicitIndex)\n";
+ OS << " setSemanticIndex(SemanticIndex);\n";
+ OS << " setTargetDecl(Target);\n";
+ }
+
----------------
Keenuts wrote:
Those are already added to the parent class (see `Attr.h`). This is to add the
proper parent class field initialization in the ctor this generates.
(Otherwise, if I declared them in the TD file, those wouldn't be added to the
parent class, but to each children, meaning I wouldn't be able to access those
from the parent class `HLSLSemanticAttr` which defeats the point of inheriting).
note: this comment assumes we move ahead with the inherited attribute semantic
bit this PR has. This is something we'll have to design if we decide to go with
a different model like "textual semantic attr with no semantic" and then a
"shader I/O attr" once sema gave semantic a meaning.
https://github.com/llvm/llvm-project/pull/159047
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits