[clang] [HLSL] Forward arguments in BuiltinTypeMethodBuilder::callBuiltin. NFC (PR #117789)

Damyan Pepper via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 26 13:07:08 PST 2024


================
@@ -564,9 +585,9 @@ struct BuiltinTypeMethodBuilder {
                                       OK_Ordinary);
   }
 
-  BuiltinTypeMethodBuilder &
-  callBuiltin(StringRef BuiltinName, ArrayRef<Expr *> CallParms,
-              bool AddResourceHandleAsFirstArg = true) {
+  template <typename... Ts>
+  BuiltinTypeMethodBuilder &callBuiltin(StringRef BuiltinName, Ts... ArgSpecs) {
+    SmallVector<Expr *> Args{convertPlaceholder(std::forward<Ts>(ArgSpecs))...};
----------------
damyanp wrote:

Is SmallVector smart enough for this to evaporate into being a stack allocated array, or is there a chance that it might make a heap allocation to store the args?

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


More information about the cfe-commits mailing list