[llvm] [DirectX] add enum for PSV resource type/kind/flag. (PR #106227)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 11:40:36 PDT 2024


================
@@ -89,3 +89,33 @@ static const EnumEntry<PSV::InterpolationMode> InterpolationModeNames[] = {
 ArrayRef<EnumEntry<PSV::InterpolationMode>> PSV::getInterpolationModes() {
   return ArrayRef(InterpolationModeNames);
 }
+
+#define RESOURCE_TYPE(Val, Enum) {#Enum, PSV::ResourceType::Enum},
+
+static const EnumEntry<PSV::ResourceType> ResourceTypeNames[] = {
+#include "llvm/BinaryFormat/DXContainerConstants.def"
+};
----------------
bogner wrote:

Nit: Style-wise, we usually put the `#define` immediately before `#include` of a def file, like so:
```suggestion
static const EnumEntry<PSV::ResourceType> ResourceTypeNames[] = {
#define RESOURCE_TYPE(Val, Enum) {#Enum, PSV::ResourceType::Enum},
#include "llvm/BinaryFormat/DXContainerConstants.def"
};
```

I find this makes it more obvious that the two things are connected. This suggestion also applies to the enum definitions in the header.

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


More information about the llvm-commits mailing list