[clang] [llvm] [DirectX] Validate registers are bound to root signature (PR #146785)

Chris B via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 25 07:46:37 PDT 2025


================
@@ -24,6 +26,48 @@ using namespace llvm;
 using namespace llvm::dxil;
 
 namespace {
+static const char *ResourceClassToString(llvm::dxil::ResourceClass Class) {
----------------
llvm-beanz wrote:

```suggestion
static StringRef ResourceClassToString(llvm::dxil::ResourceClass Class) {
```

Prefer `StringRef` over `const char*`. Most users of strings require knowing the length at some point. The constructor for `StringRef` is a `constexpr` so the size is computed at compile time and preserved, that avoids needing to walk the string at runtime to figure out how long it is.

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


More information about the llvm-commits mailing list