-
Notifications
You must be signed in to change notification settings - Fork 11.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add arrangeCXXMethodCall to the CodeGenABITypes interface. #111597
base: main
Are you sure you want to change the base?
Conversation
✅ With the latest revision this PR passed the C/C++ code formatter. |
In MSVC, the calling conventions for free functions and C++ instance methods could be different, it makes sense to have this variant there.
7be9488
to
4744991
Compare
@llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-clang Author: Hiroshi Yamauchi (hjyamauchi) ChangesIn 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:
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,
|
CanQualType returnType, | ||
ArrayRef<CanQualType> argTypes, | ||
FunctionType::ExtInfo info, | ||
RequiredArgs args); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. The internal function for this now takes an array of ExtParameterInfo
s. As long as we're introducing new API, could you go ahead and add that parameter to these functions? You'll need to either add overloads or give it a default argument (an empty array is an acceptable default).
You just need to modify the functions that don't take a FunctionProtoType
.
In MSVC, the calling conventions for free functions and C++ instance methods could be different, it makes sense to have this variant there.