[clang] Add arrangeCXXMethodCall to the CodeGenABITypes interface. (PR #111597)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 8 15:52:51 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Hiroshi Yamauchi (hjyamauchi)

<details>
<summary>Changes</summary>

In MSVC, the calling conventions for free functions and C++ instance methods could be different, it makes sense to have this variant there.

---
Full diff: https://github.com/llvm/llvm-project/pull/111597.diff


2 Files Affected:

- (modified) clang/include/clang/CodeGen/CodeGenABITypes.h (+6) 
- (modified) clang/lib/CodeGen/CodeGenABITypes.cpp (+8) 


``````````diff
diff --git a/clang/include/clang/CodeGen/CodeGenABITypes.h b/clang/include/clang/CodeGen/CodeGenABITypes.h
index 9cbc5a8a2a3f41..3d29c45cf0cf1b 100644
--- a/clang/include/clang/CodeGen/CodeGenABITypes.h
+++ b/clang/include/clang/CodeGen/CodeGenABITypes.h
@@ -75,6 +75,12 @@ const CGFunctionInfo &arrangeCXXMethodType(CodeGenModule &CGM,
                                            const FunctionProtoType *FTP,
                                            const CXXMethodDecl *MD);
 
+const CGFunctionInfo &arrangeCXXMethodCall(CodeGenModule &CGM,
+                                           CanQualType returnType,
+                                           ArrayRef<CanQualType> argTypes,
+                                           FunctionType::ExtInfo info,
+                                           RequiredArgs args);
+
 const CGFunctionInfo &arrangeFreeFunctionCall(CodeGenModule &CGM,
                                               CanQualType returnType,
                                               ArrayRef<CanQualType> argTypes,
diff --git a/clang/lib/CodeGen/CodeGenABITypes.cpp b/clang/lib/CodeGen/CodeGenABITypes.cpp
index a6073e1188d6fa..972bc4137c6053 100644
--- a/clang/lib/CodeGen/CodeGenABITypes.cpp
+++ b/clang/lib/CodeGen/CodeGenABITypes.cpp
@@ -59,6 +59,14 @@ CodeGen::arrangeCXXMethodType(CodeGenModule &CGM,
   return CGM.getTypes().arrangeCXXMethodType(RD, FTP, MD);
 }
 
+const CGFunctionInfo &
+CodeGen::arrangeCXXMethodCall(CodeGenModule &CGM, CanQualType returnType,
+                              ArrayRef<CanQualType> argTypes,
+                              FunctionType::ExtInfo info, RequiredArgs args) {
+  return CGM.getTypes().arrangeLLVMFunctionInfo(
+      returnType, FnInfoOpts::IsInstanceMethod, argTypes, info, {}, args);
+}
+
 const CGFunctionInfo &
 CodeGen::arrangeFreeFunctionCall(CodeGenModule &CGM,
                                  CanQualType returnType,

``````````

</details>


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


More information about the cfe-commits mailing list