Skip to content

Commit 1de15c1

Browse files
authored
Add arrangeCXXMethodCall to the CodeGenABITypes interface. (#111597)
In MSVC, the calling conventions for free functions and C++ instance methods could be different, it makes sense to have this variant there.
1 parent aad3a16 commit 1de15c1

File tree

2 files changed

+36
-13
lines changed

2 files changed

+36
-13
lines changed

clang/include/clang/CodeGen/CodeGenABITypes.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,25 @@ const CGFunctionInfo &arrangeCXXMethodType(CodeGenModule &CGM,
7575
const FunctionProtoType *FTP,
7676
const CXXMethodDecl *MD);
7777

78-
const CGFunctionInfo &arrangeFreeFunctionCall(CodeGenModule &CGM,
79-
CanQualType returnType,
80-
ArrayRef<CanQualType> argTypes,
81-
FunctionType::ExtInfo info,
82-
RequiredArgs args);
78+
const CGFunctionInfo &
79+
arrangeCXXMethodCall(CodeGenModule &CGM, CanQualType returnType,
80+
ArrayRef<CanQualType> argTypes, FunctionType::ExtInfo info,
81+
ArrayRef<FunctionProtoType::ExtParameterInfo> paramInfos,
82+
RequiredArgs args);
83+
84+
const CGFunctionInfo &arrangeFreeFunctionCall(
85+
CodeGenModule &CGM, CanQualType returnType, ArrayRef<CanQualType> argTypes,
86+
FunctionType::ExtInfo info,
87+
ArrayRef<FunctionProtoType::ExtParameterInfo> paramInfos,
88+
RequiredArgs args);
89+
90+
// An overload with an empty `paramInfos`
91+
inline const CGFunctionInfo &
92+
arrangeFreeFunctionCall(CodeGenModule &CGM, CanQualType returnType,
93+
ArrayRef<CanQualType> argTypes,
94+
FunctionType::ExtInfo info, RequiredArgs args) {
95+
return arrangeFreeFunctionCall(CGM, returnType, argTypes, info, {}, args);
96+
}
8397

8498
/// Returns the implicit arguments to add to a complete, non-delegating C++
8599
/// constructor call.

clang/lib/CodeGen/CodeGenABITypes.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,23 @@ CodeGen::arrangeCXXMethodType(CodeGenModule &CGM,
5959
return CGM.getTypes().arrangeCXXMethodType(RD, FTP, MD);
6060
}
6161

62-
const CGFunctionInfo &
63-
CodeGen::arrangeFreeFunctionCall(CodeGenModule &CGM,
64-
CanQualType returnType,
65-
ArrayRef<CanQualType> argTypes,
66-
FunctionType::ExtInfo info,
67-
RequiredArgs args) {
68-
return CGM.getTypes().arrangeLLVMFunctionInfo(returnType, FnInfoOpts::None,
69-
argTypes, info, {}, args);
62+
const CGFunctionInfo &CodeGen::arrangeCXXMethodCall(
63+
CodeGenModule &CGM, CanQualType returnType, ArrayRef<CanQualType> argTypes,
64+
FunctionType::ExtInfo info,
65+
ArrayRef<FunctionProtoType::ExtParameterInfo> paramInfos,
66+
RequiredArgs args) {
67+
return CGM.getTypes().arrangeLLVMFunctionInfo(
68+
returnType, FnInfoOpts::IsInstanceMethod, argTypes, info, paramInfos,
69+
args);
70+
}
71+
72+
const CGFunctionInfo &CodeGen::arrangeFreeFunctionCall(
73+
CodeGenModule &CGM, CanQualType returnType, ArrayRef<CanQualType> argTypes,
74+
FunctionType::ExtInfo info,
75+
ArrayRef<FunctionProtoType::ExtParameterInfo> paramInfos,
76+
RequiredArgs args) {
77+
return CGM.getTypes().arrangeLLVMFunctionInfo(
78+
returnType, FnInfoOpts::None, argTypes, info, paramInfos, args);
7079
}
7180

7281
ImplicitCXXConstructorArgs

0 commit comments

Comments
 (0)