From 12f83a2aa15e4cfa8936cba666207a5a318f5d1b Mon Sep 17 00:00:00 2001 From: Martin Boehme Date: Wed, 29 Apr 2020 15:33:45 +0200 Subject: [PATCH] Expose arrangeCXXConstructorCall in CodeGenABITypes.h. --- clang/include/clang/CodeGen/CodeGenABITypes.h | 6 ++++++ clang/lib/CodeGen/CGCall.cpp | 10 ++++++++++ clang/lib/CodeGen/CodeGenABITypes.cpp | 9 +++++++++ clang/lib/CodeGen/CodeGenTypes.h | 6 ++++++ 4 files changed, 31 insertions(+) diff --git a/clang/include/clang/CodeGen/CodeGenABITypes.h b/clang/include/clang/CodeGen/CodeGenABITypes.h index a8457ac349cd6..8d617169424c1 100644 --- a/clang/include/clang/CodeGen/CodeGenABITypes.h +++ b/clang/include/clang/CodeGen/CodeGenABITypes.h @@ -38,6 +38,7 @@ namespace llvm { namespace clang { class ASTContext; +class CXXConstructorDecl; class CXXRecordDecl; class CXXMethodDecl; class CodeGenOptions; @@ -73,6 +74,11 @@ const CGFunctionInfo &arrangeFreeFunctionCall(CodeGenModule &CGM, FunctionType::ExtInfo info, RequiredArgs args); +const CGFunctionInfo &arrangeCXXConstructorCall(CodeGenModule &CGM, + const CXXConstructorDecl *CD, + ArrayRef argTypes, + FunctionType::ExtInfo info); + /// Returns null if the function type is incomplete and can't be lowered. llvm::FunctionType *convertFreeFunctionType(CodeGenModule &CGM, const FunctionDecl *FD); diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index bfb7977e35162..1a245e780c7c8 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -398,6 +398,16 @@ CodeGenTypes::arrangeCXXConstructorCall(const CallArgList &args, for (const auto &Arg : args) ArgTypes.push_back(Context.getCanonicalParamType(Arg.Ty)); + return arrangeCXXConstructorCall(ArgTypes, D, CtorKind, ExtraPrefixArgs, ExtraSuffixArgs, PassProtoArgs); +} + +const CGFunctionInfo & +CodeGenTypes::arrangeCXXConstructorCall(ArrayRef ArgTypes, + const CXXConstructorDecl *D, + CXXCtorType CtorKind, + unsigned ExtraPrefixArgs, + unsigned ExtraSuffixArgs, + bool PassProtoArgs) { // +1 for implicit this, which should always be args[0]. unsigned TotalPrefixArgs = 1 + ExtraPrefixArgs; diff --git a/clang/lib/CodeGen/CodeGenABITypes.cpp b/clang/lib/CodeGen/CodeGenABITypes.cpp index 6b6a116cf259b..25aa228750bd6 100644 --- a/clang/lib/CodeGen/CodeGenABITypes.cpp +++ b/clang/lib/CodeGen/CodeGenABITypes.cpp @@ -63,6 +63,15 @@ CodeGen::arrangeFreeFunctionCall(CodeGenModule &CGM, info, {}, args); } +const CGFunctionInfo & +CodeGen::arrangeCXXConstructorCall(CodeGenModule &CGM, + const CXXConstructorDecl *CD, + ArrayRef argTypes, + FunctionType::ExtInfo info) { + return CGM.getTypes().arrangeCXXConstructorCall(argTypes, CD, Ctor_Complete, 0, 0); +} + + llvm::FunctionType * CodeGen::convertFreeFunctionType(CodeGenModule &CGM, const FunctionDecl *FD) { assert(FD != nullptr && "Expected a non-null function declaration!"); diff --git a/clang/lib/CodeGen/CodeGenTypes.h b/clang/lib/CodeGen/CodeGenTypes.h index 03102329507eb..734cf40d600f5 100644 --- a/clang/lib/CodeGen/CodeGenTypes.h +++ b/clang/lib/CodeGen/CodeGenTypes.h @@ -244,6 +244,12 @@ class CodeGenTypes { unsigned ExtraPrefixArgs, unsigned ExtraSuffixArgs, bool PassProtoArgs = true); + const CGFunctionInfo &arrangeCXXConstructorCall(ArrayRef ArgTypes, + const CXXConstructorDecl *D, + CXXCtorType CtorKind, + unsigned ExtraPrefixArgs, + unsigned ExtraSuffixArgs, + bool PassProtoArgs = true); const CGFunctionInfo &arrangeCXXMethodCall(const CallArgList &args, const FunctionProtoType *type,