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

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


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

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

>From 7be9488cc36596788ea6a1b979cb028e3c28e961 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         | 11 +++++++++++
 2 files changed, 17 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..283aa8425867ab 100644
--- a/clang/lib/CodeGen/CodeGenABITypes.cpp
+++ b/clang/lib/CodeGen/CodeGenABITypes.cpp
@@ -59,6 +59,17 @@ 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