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

Hiroshi Yamauchi via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 8 15:38:18 PDT 2024


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

>From 47449911273a69b5a2aa89789aeb7e35b66ff0e2 Mon Sep 17 00:00:00 2001
From: Hiroshi Yamauchi <hjyamauchi at gmail.com>
Date: Tue, 8 Oct 2024 15:16:06 -0700
Subject: [PATCH] Add arrangeCXXMethodCall to the CodeGenABITypes interface.

In MSVC, the calling conventions for free functions and C++ instance
methods could be different, it makes sense to have this variant there.
---
 clang/include/clang/CodeGen/CodeGenABITypes.h | 6 ++++++
 clang/lib/CodeGen/CodeGenABITypes.cpp         | 8 ++++++++
 2 files changed, 14 insertions(+)

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,



More information about the cfe-commits mailing list