[clang] [HLSL] Add static methods for resource initialization (PR #155866)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 10 09:32:28 PDT 2025


================
@@ -676,6 +774,58 @@ BuiltinTypeDeclBuilder::addHandleConstructorFromImplicitBinding() {
       .finalize();
 }
 
+BuiltinTypeDeclBuilder &BuiltinTypeDeclBuilder::addCreateFromBinding() {
----------------
bogner wrote:

I think Alex was trying to say that the implementations of the builder functions are really similar. That is, would it be worth it to abstract out a helper along the lines of
```c++
BuiltinTypeDeclBuilder &addStaticResoureConstructor(StringRef Name, StringRef Builtin, ArrayRef<std::pair<StringRef, QualType>> Params);
```

I think it might clean this up a bit, but I'm also okay with waiting for some of the other initialization functions to come in before settling on the best abstraction here. Up to you.

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


More information about the cfe-commits mailing list