[llvm] [DirectX] Adding support for Root Descriptors in obj2yaml/yaml2obj (PR #137259)

Sarah Spall via llvm-commits llvm-commits at lists.llvm.org
Sat May 3 10:07:54 PDT 2025


https://github.com/spall commented:

I think my biggest issue with this PR is the use of inheritance for the two RootDescriptor structs. The style of declaring the Child struct everywhere when it is sometimes the Base struct goes against normal style, and misleads the reader. This also leads to sometimes not fully initializing the Child struct using memcpy, leaving garbage in the uninitialized field. 
Since in this style you are checking the version everywhere, you could write this code in a way which assumes the Base class and checks for the child class.
See example of what I mean: https://godbolt.org/z/6GnbGarz5

https://github.com/llvm/llvm-project/pull/137259


More information about the llvm-commits mailing list