diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:44:14 +0000 |
| commit | 2b6b257f4e5503a7a2675bdb8735693db769f75c (patch) | |
| tree | e85e046ae7003fe3bcc8b5454cd0fa3f7407b470 /lib/CodeGen/CodeGenTypes.h | |
| parent | b4348ed0b7e90c0831b925fbee00b5f179a99796 (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/CodeGenTypes.h')
| -rw-r--r-- | lib/CodeGen/CodeGenTypes.h | 75 |
1 files changed, 56 insertions, 19 deletions
diff --git a/lib/CodeGen/CodeGenTypes.h b/lib/CodeGen/CodeGenTypes.h index a96f23c44894..5796ab8fe5aa 100644 --- a/lib/CodeGen/CodeGenTypes.h +++ b/lib/CodeGen/CodeGenTypes.h @@ -31,7 +31,6 @@ class StructType; } namespace clang { -class ABIInfo; class ASTContext; template <typename> class CanQual; class CXXConstructorDecl; @@ -51,6 +50,7 @@ class Type; typedef CanQual<Type> CanQualType; namespace CodeGen { +class ABIInfo; class CGCXXABI; class CGRecordLayout; class CodeGenModule; @@ -162,6 +162,10 @@ class CodeGenTypes { /// corresponding llvm::Type. llvm::DenseMap<const Type *, llvm::Type *> TypeCache; + llvm::SmallSet<const Type *, 8> RecordsWithOpaqueMemberPointers; + + unsigned ClangCallConvToLLVMCallConv(CallingConv CC); + public: CodeGenTypes(CodeGenModule &cgm); ~CodeGenTypes(); @@ -203,6 +207,11 @@ public: bool isFuncTypeConvertible(const FunctionType *FT); bool isFuncParamTypeConvertible(QualType Ty); + /// Determine if a C++ inheriting constructor should have parameters matching + /// those of its inherited constructor. + bool inheritingCtorHasParams(const InheritedConstructor &Inherited, + CXXCtorType Type); + /// GetFunctionTypeForVTable - Get the LLVM function type for use in a vtable, /// given a CXXMethodDecl. If the method to has an incomplete return type, /// and/or incomplete argument types, this will return the opaque type. @@ -214,9 +223,9 @@ public: /// replace the 'opaque' type we previously made for it if applicable. void UpdateCompletedType(const TagDecl *TD); - /// getNullaryFunctionInfo - Get the function info for a void() - /// function with standard CC. - const CGFunctionInfo &arrangeNullaryFunction(); + /// \brief Remove stale types from the type cache when an inheritance model + /// gets assigned to a class. + void RefreshTypeCacheForClass(const CXXRecordDecl *RD); // The arrangement methods are split into three families: // - those meant to drive the signature and prologue/epilogue @@ -239,16 +248,55 @@ public: // this for compatibility reasons. const CGFunctionInfo &arrangeGlobalDeclaration(GlobalDecl GD); + + /// Given a function info for a declaration, return the function info + /// for a call with the given arguments. + /// + /// Often this will be able to simply return the declaration info. + const CGFunctionInfo &arrangeCall(const CGFunctionInfo &declFI, + const CallArgList &args); + + /// Free functions are functions that are compatible with an ordinary + /// C function pointer type. const CGFunctionInfo &arrangeFunctionDeclaration(const FunctionDecl *FD); + const CGFunctionInfo &arrangeFreeFunctionCall(const CallArgList &Args, + const FunctionType *Ty, + bool ChainCall); + const CGFunctionInfo &arrangeFreeFunctionType(CanQual<FunctionProtoType> Ty, + const FunctionDecl *FD); + const CGFunctionInfo &arrangeFreeFunctionType(CanQual<FunctionNoProtoType> Ty); + + /// A nullary function is a freestanding function of type 'void ()'. + /// This method works for both calls and declarations. + const CGFunctionInfo &arrangeNullaryFunction(); + + /// A builtin function is a freestanding function using the default + /// C conventions. const CGFunctionInfo & - arrangeFreeFunctionDeclaration(QualType ResTy, const FunctionArgList &Args, - const FunctionType::ExtInfo &Info, - bool isVariadic); + arrangeBuiltinFunctionDeclaration(QualType resultType, + const FunctionArgList &args); + const CGFunctionInfo & + arrangeBuiltinFunctionDeclaration(CanQualType resultType, + ArrayRef<CanQualType> argTypes); + const CGFunctionInfo &arrangeBuiltinFunctionCall(QualType resultType, + const CallArgList &args); + /// Objective-C methods are C functions with some implicit parameters. const CGFunctionInfo &arrangeObjCMethodDeclaration(const ObjCMethodDecl *MD); const CGFunctionInfo &arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD, QualType receiverType); + const CGFunctionInfo &arrangeUnprototypedObjCMessageSend( + QualType returnType, + const CallArgList &args); + + /// Block invocation functions are C functions with an implicit parameter. + const CGFunctionInfo &arrangeBlockFunctionDeclaration( + const FunctionProtoType *type, + const FunctionArgList &args); + const CGFunctionInfo &arrangeBlockFunctionCall(const CallArgList &args, + const FunctionType *type); + /// C++ methods have some special rules and also have implicit parameters. const CGFunctionInfo &arrangeCXXMethodDeclaration(const CXXMethodDecl *MD); const CGFunctionInfo &arrangeCXXStructorDeclaration(const CXXMethodDecl *MD, StructorType Type); @@ -256,15 +304,6 @@ public: const CXXConstructorDecl *D, CXXCtorType CtorKind, unsigned ExtraArgs); - const CGFunctionInfo &arrangeFreeFunctionCall(const CallArgList &Args, - const FunctionType *Ty, - bool ChainCall); - const CGFunctionInfo &arrangeFreeFunctionCall(QualType ResTy, - const CallArgList &args, - FunctionType::ExtInfo info, - RequiredArgs required); - const CGFunctionInfo &arrangeBlockFunctionCall(const CallArgList &args, - const FunctionType *type); const CGFunctionInfo &arrangeCXXMethodCall(const CallArgList &args, const FunctionProtoType *type, @@ -272,9 +311,6 @@ public: const CGFunctionInfo &arrangeMSMemberPointerThunk(const CXXMethodDecl *MD); const CGFunctionInfo &arrangeMSCtorClosure(const CXXConstructorDecl *CD, CXXCtorType CT); - const CGFunctionInfo &arrangeFreeFunctionType(CanQual<FunctionProtoType> Ty, - const FunctionDecl *FD); - const CGFunctionInfo &arrangeFreeFunctionType(CanQual<FunctionNoProtoType> Ty); const CGFunctionInfo &arrangeCXXMethodType(const CXXRecordDecl *RD, const FunctionProtoType *FTP, const CXXMethodDecl *MD); @@ -290,6 +326,7 @@ public: bool chainCall, ArrayRef<CanQualType> argTypes, FunctionType::ExtInfo info, + ArrayRef<FunctionProtoType::ExtParameterInfo> paramInfos, RequiredArgs args); /// \brief Compute a new LLVM record layout object for the given record. |
