================
@@ -421,13 +444,32 @@ BuiltinTypeMethodBuilder::addParam(StringRef Name, 
QualType Ty,
 void BuiltinTypeMethodBuilder::createDecl() {
   assert(Method == nullptr && "Method or constructor is already created");
 
-  // create method or constructor type
+  // create function prototype
   ASTContext &AST = DeclBuilder.SemaRef.getASTContext();
   SmallVector<QualType> ParamTypes;
-  for (Param &MP : Params)
-    ParamTypes.emplace_back(MP.Ty);
+  SmallVector<FunctionType::ExtParameterInfo> ParamExtInfos(Params.size());
+  uint32_t ArgIndex = 0;
+  bool IsTemplate = DeclBuilder.Template != nullptr;
+  bool UseParamExtInfo = false;
+  for (Param &MP : Params) {
+    QualType Ty = MP.Ty;
+    if (MP.Modifier != HLSLParamModifierAttr::Keyword_in) {
+      UseParamExtInfo = true;
+      ParamExtInfos[ArgIndex].withABI(
+          convertParamModifierToParamABI(MP.Modifier));
+      // Only update types on inout and out parameters for non-templated
+      // methods. Templated types will have their inout/out parameters
+      // converted to references during template instantiation.
+      if (!IsTemplate)
+        Ty = getInoutParameterType(AST, Ty);
+    }
+    ParamTypes.emplace_back(Ty);
+    ++ArgIndex;
+  }
----------------
hekota wrote:

Bug fix in review: https://github.com/llvm/llvm-project/pull/163832

I have updated this to always change the type of `inout` and `out` parameter to 
a reference - unless the parameter type is dependent on the template 
instantiation. It turns out it is needed for both the function prototype (ABI 
params & type) and for the param list on the decl.

I also had a bug in how the ABI params were set (or not set, actually), which 
is why the function prototype string did not include the `out` modifier in the 
AST dump. This is now fixed. 

https://github.com/llvm/llvm-project/pull/161929
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to