diff options
Diffstat (limited to 'include/clang/CodeGen/CGFunctionInfo.h')
-rw-r--r-- | include/clang/CodeGen/CGFunctionInfo.h | 54 |
1 files changed, 20 insertions, 34 deletions
diff --git a/include/clang/CodeGen/CGFunctionInfo.h b/include/clang/CodeGen/CGFunctionInfo.h index 58d1f0d71c..1f81072e23 100644 --- a/include/clang/CodeGen/CGFunctionInfo.h +++ b/include/clang/CodeGen/CGFunctionInfo.h @@ -1,9 +1,8 @@ //==-- CGFunctionInfo.h - Representation of function argument/return types -==// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -96,7 +95,6 @@ private: bool InReg : 1; // isDirect() || isExtend() || isIndirect() bool CanBeFlattened: 1; // isDirect() bool SignExt : 1; // isExtend() - bool SuppressSRet : 1; // isIndirect() bool canHavePaddingType() const { return isDirect() || isExtend() || isIndirect() || isExpand(); @@ -112,14 +110,13 @@ private: } ABIArgInfo(Kind K) - : TheKind(K), PaddingInReg(false), InReg(false), SuppressSRet(false) { + : TheKind(K), PaddingInReg(false), InReg(false) { } public: ABIArgInfo() : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0), - TheKind(Direct), PaddingInReg(false), InReg(false), - SuppressSRet(false) {} + TheKind(Direct), PaddingInReg(false), InReg(false) {} static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0, llvm::Type *Padding = nullptr, @@ -408,16 +405,6 @@ public: CanBeFlattened = Flatten; } - bool getSuppressSRet() const { - assert(isIndirect() && "Invalid kind!"); - return SuppressSRet; - } - - void setSuppressSRet(bool Suppress) { - assert(isIndirect() && "Invalid kind!"); - SuppressSRet = Suppress; - } - void dump() const; }; @@ -441,31 +428,30 @@ public: /// /// If FD is not null, this will consider pass_object_size params in FD. static RequiredArgs forPrototypePlus(const FunctionProtoType *prototype, - unsigned additional, - const FunctionDecl *FD) { + unsigned additional) { if (!prototype->isVariadic()) return All; - if (FD) - additional += - llvm::count_if(FD->parameters(), [](const ParmVarDecl *PVD) { - return PVD->hasAttr<PassObjectSizeAttr>(); + + if (prototype->hasExtParameterInfos()) + additional += llvm::count_if( + prototype->getExtParameterInfos(), + [](const FunctionProtoType::ExtParameterInfo &ExtInfo) { + return ExtInfo.hasPassObjectSize(); }); + return RequiredArgs(prototype->getNumParams() + additional); } - static RequiredArgs forPrototype(const FunctionProtoType *prototype, - const FunctionDecl *FD) { - return forPrototypePlus(prototype, 0, FD); + static RequiredArgs forPrototypePlus(CanQual<FunctionProtoType> prototype, + unsigned additional) { + return forPrototypePlus(prototype.getTypePtr(), additional); } - static RequiredArgs forPrototype(CanQual<FunctionProtoType> prototype, - const FunctionDecl *FD) { - return forPrototype(prototype.getTypePtr(), FD); + static RequiredArgs forPrototype(const FunctionProtoType *prototype) { + return forPrototypePlus(prototype, 0); } - static RequiredArgs forPrototypePlus(CanQual<FunctionProtoType> prototype, - unsigned additional, - const FunctionDecl *FD) { - return forPrototypePlus(prototype.getTypePtr(), additional, FD); + static RequiredArgs forPrototype(CanQual<FunctionProtoType> prototype) { + return forPrototypePlus(prototype.getTypePtr(), 0); } bool allowsOptionalArgs() const { return NumRequired != ~0U; } |