================
@@ -116,12 +116,15 @@ struct BuiltinTypeDeclBuilder {
QualType(TTD->getTypeForDecl(), 0));
}
// add handle member
- llvm::SmallVector<Attr *, 2> Attrs;
Attr *ResourceClassAttr =
HLSLResourceClassAttr::CreateImplicit(Record->getASTContext(), RC);
Attr *ResourceAttr =
- HLSLResourceAttr::CreateImplicit(Record->getASTContext(), RK, IsROV);
+ HLSLResourceAttr::CreateImplicit(Record->getASTContext(), RK);
addMemberVariable("h", Ty, {ResourceClassAttr, ResourceAttr}, Access);
+ if (IsROV)
----------------
damyanp wrote:
It would be nice if we could find a way to be more consistent with how the
other attributes are added to the field, and so only follow a single pattern
for adding them.
What if we arranged it so we could write:
```c++
Attr *ResourceClassAttr =
HLSLResourceClassAttr::CreateImplicit(Record->getASTContext(), RC);
Attr *ResourceAttr =
HLSLResourceAttr::CreateImplicit(Record->getASTContext(), RK);
Attr *ROVAttr = IsRov ? HLSLROVAttr::CreateImplicit(Record->getASTContents()) :
nullptr;
addMemberVariable("h", Ty, {ResourceClassAttr, ResourceAttr, ROVAttr}, Access);
```
There may be other ways to slice it - my main request here is that we end up
with a consistent way of doing this.
Remember `addMemberVariable` _only_ exists in order for us to create this `h`
member, so we can adapt it to work well for this purpose.
https://github.com/llvm/llvm-project/pull/102414
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits