github-actions[bot] wrote: <!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning: <details> <summary> You can test this locally with the following command: </summary> ``````````bash git-clang-format --diff c9055e9780683735392ac0e74163020015eabf15 2fde3d1079bed13375456975e7ac8167103e9f9f --extensions h,cpp -- LLVMABI/CGFunctionInfo.h clang/lib/CodeGen/CGCall.cpp `````````` </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/LLVMABI/CGFunctionInfo.h b/LLVMABI/CGFunctionInfo.h index 91276e743a..3faf027757 100644 --- a/LLVMABI/CGFunctionInfo.h +++ b/LLVMABI/CGFunctionInfo.h @@ -19,8 +19,8 @@ #include "clang/AST/CharUnits.h" #include "clang/AST/Decl.h" #include "clang/AST/Type.h" -#include "llvm/IR/DerivedTypes.h" #include "llvm/ADT/FoldingSet.h" +#include "llvm/IR/DerivedTypes.h" #include "llvm/Support/TrailingObjects.h" #include <cassert> @@ -90,7 +90,7 @@ public: private: llvm::Type *TypeData; // canHaveCoerceToType() union { - llvm::Type *PaddingType; // canHavePaddingType() + llvm::Type *PaddingType; // canHavePaddingType() llvm::Type *UnpaddedCoerceAndExpandType; // isCoerceAndExpand() }; struct DirectAttrInfo { @@ -104,19 +104,19 @@ private: union { DirectAttrInfo DirectAttr; // isDirect() || isExtend() IndirectAttrInfo IndirectAttr; // isIndirect() - unsigned AllocaFieldIndex; // isInAlloca() + unsigned AllocaFieldIndex; // isInAlloca() }; Kind TheKind; bool PaddingInReg : 1; - bool InAllocaSRet : 1; // isInAlloca() - bool InAllocaIndirect : 1;// isInAlloca() - bool IndirectByVal : 1; // isIndirect() - bool IndirectRealign : 1; // isIndirect() - bool SRetAfterThis : 1; // isIndirect() - bool InReg : 1; // isDirect() || isExtend() || isIndirect() - bool CanBeFlattened: 1; // isDirect() - bool SignExt : 1; // isExtend() - bool ZeroExt : 1; // isExtend() + bool InAllocaSRet : 1; // isInAlloca() + bool InAllocaIndirect : 1; // isInAlloca() + bool IndirectByVal : 1; // isIndirect() + bool IndirectRealign : 1; // isIndirect() + bool SRetAfterThis : 1; // isIndirect() + bool InReg : 1; // isDirect() || isExtend() || isIndirect() + bool CanBeFlattened : 1; // isDirect() + bool SignExt : 1; // isExtend() + bool ZeroExt : 1; // isExtend() bool canHavePaddingType() const { return isDirect() || isExtend() || isIndirect() || isIndirectAliased() || @@ -135,10 +135,9 @@ private: public: ABIArgInfo(Kind K = Direct) : TypeData(nullptr), PaddingType(nullptr), DirectAttr{0, 0}, TheKind(K), - PaddingInReg(false), InAllocaSRet(false), - InAllocaIndirect(false), IndirectByVal(false), IndirectRealign(false), - SRetAfterThis(false), InReg(false), CanBeFlattened(false), - SignExt(false), ZeroExt(false) {} + PaddingInReg(false), InAllocaSRet(false), InAllocaIndirect(false), + IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false), + InReg(false), CanBeFlattened(false), SignExt(false), ZeroExt(false) {} static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0, llvm::Type *Padding = nullptr, @@ -203,9 +202,7 @@ public: AI.setInReg(true); return AI; } - static ABIArgInfo getIgnore() { - return ABIArgInfo(Ignore); - } + static ABIArgInfo getIgnore() { return ABIArgInfo(Ignore); } static ABIArgInfo getIndirect(CharUnits Alignment, unsigned AddrSpace, bool ByVal = true, bool Realign = false, llvm::Type *Padding = nullptr) { @@ -356,12 +353,8 @@ public: return (canHavePaddingType() ? PaddingType : nullptr); } - bool getPaddingInReg() const { - return PaddingInReg; - } - void setPaddingInReg(bool PIR) { - PaddingInReg = PIR; - } + bool getPaddingInReg() const { return PaddingInReg; } + void setPaddingInReg(bool PIR) { PaddingInReg = PIR; } llvm::Type *getCoerceToType() const { assert(canHaveCoerceToType() && "Invalid kind!"); @@ -383,10 +376,10 @@ public: return UnpaddedCoerceAndExpandType; } - ArrayRef<llvm::Type *>getCoerceAndExpandTypeSequence() const { + ArrayRef<llvm::Type *> getCoerceAndExpandTypeSequence() const { assert(isCoerceAndExpand()); if (auto structTy = - dyn_cast<llvm::StructType>(UnpaddedCoerceAndExpandType)) { + dyn_cast<llvm::StructType>(UnpaddedCoerceAndExpandType)) { return structTy->elements(); } else { return llvm::ArrayRef(&UnpaddedCoerceAndExpandType, 1); @@ -499,13 +492,12 @@ class RequiredArgs { /// The number of required arguments, or ~0 if the signature does /// not permit optional arguments. unsigned NumRequired; + public: enum All_t { All }; RequiredArgs(All_t _) : NumRequired(~0U) {} - explicit RequiredArgs(unsigned n) : NumRequired(n) { - assert(n != ~0U); - } + explicit RequiredArgs(unsigned n) : NumRequired(n) { assert(n != ~0U); } /// Compute the arguments required by the given formal prototype, /// given that there may be some additional, non-formal arguments @@ -514,7 +506,8 @@ public: /// If FD is not null, this will consider pass_object_size params in FD. static RequiredArgs forPrototypePlus(const FunctionProtoType *prototype, unsigned additional) { - if (!prototype->isVariadic()) return All; + if (!prototype->isVariadic()) + return All; if (prototype->hasExtParameterInfos()) additional += llvm::count_if( @@ -552,7 +545,8 @@ public: unsigned getOpaqueData() const { return NumRequired; } static RequiredArgs getFromOpaqueData(unsigned value) { - if (value == ~0U) return All; + if (value == ~0U) + return All; return RequiredArgs(value); } }; @@ -637,17 +631,13 @@ class CGFunctionInfo final unsigned NumArgs; - ArgInfo *getArgsBuffer() { - return getTrailingObjects<ArgInfo>(); - } - const ArgInfo *getArgsBuffer() const { - return getTrailingObjects<ArgInfo>(); - } + ArgInfo *getArgsBuffer() { return getTrailingObjects<ArgInfo>(); } + const ArgInfo *getArgsBuffer() const { return getTrailingObjects<ArgInfo>(); } ExtParameterInfo *getExtParameterInfosBuffer() { return getTrailingObjects<ExtParameterInfo>(); } - const ExtParameterInfo *getExtParameterInfosBuffer() const{ + const ExtParameterInfo *getExtParameterInfosBuffer() const { return getTrailingObjects<ExtParameterInfo>(); } @@ -686,7 +676,7 @@ public: arg_iterator arg_begin() { return getArgsBuffer() + 1; } arg_iterator arg_end() { return getArgsBuffer() + 1 + NumArgs; } - unsigned arg_size() const { return NumArgs; } + unsigned arg_size() const { return NumArgs; } bool isVariadic() const { return Required.allowsOptionalArgs(); } RequiredArgs getRequiredArgs() const { return Required; } @@ -721,7 +711,9 @@ public: } /// getCallingConvention - Return the user specified calling - /// convention, which has been translated into an LLVM CC. //this is important, that clang/ast calling convention has been translated into an llvm (target specific?) calling convention. + /// convention, which has been translated into an LLVM CC. //this is + /// important, that clang/ast calling convention has been translated into an + /// llvm (target specific?) calling convention. unsigned getCallingConvention() const { return CallingConvention; } /// getEffectiveCallingConvention - Return the actual calling convention to @@ -749,12 +741,14 @@ public: const ABIArgInfo &getReturnInfo() const { return getArgsBuffer()[0].info; } ArrayRef<ExtParameterInfo> getExtParameterInfos() const { - if (!HasExtParameterInfos) return {}; + if (!HasExtParameterInfos) + return {}; return llvm::ArrayRef(getExtParameterInfosBuffer(), NumArgs); } ExtParameterInfo getExtParameterInfo(unsigned argIndex) const { assert(argIndex <= NumArgs); - if (!HasExtParameterInfos) return ExtParameterInfo(); + if (!HasExtParameterInfos) + return ExtParameterInfo(); return getExtParameterInfos()[argIndex]; } @@ -828,14 +822,15 @@ public: ID.AddInteger(paramInfo.getOpaqueValue()); } resultType.Profile(ID); - for (ArrayRef<CanQualType>::iterator - i = argTypes.begin(), e = argTypes.end(); i != e; ++i) { + for (ArrayRef<CanQualType>::iterator i = argTypes.begin(), + e = argTypes.end(); + i != e; ++i) { i->Profile(ID); } } }; -} // end namespace CodeGen -} // end namespace clang +} // end namespace CodeGen +} // end namespace clang #endif diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 719af045fe..531e664016 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -808,24 +808,25 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo( assert(llvm::all_of(argTypes, [](CanQualType T) { return T.isCanonicalAsParam(); })); -// first convert each of these types into ABI::types. -> info, paramInfos, required, resultType, argTypes -// then in the library, create abi::functionInfo type, same as how CGFunctionInfo is created. -// then in the library, lower abi::functionInfo to abi::x_86_abiArgInfo -// then return that. then the frontend has to lower that to llvm-ir. -// so clang will have to map that to clang::CGFunctionInfo. + // first convert each of these types into ABI::types. -> info, paramInfos, + // required, resultType, argTypes then in the library, create + // abi::functionInfo type, same as how CGFunctionInfo is created. then in the + // library, lower abi::functionInfo to abi::x_86_abiArgInfo then return that. + // then the frontend has to lower that to llvm-ir. so clang will have to map + // that to clang::CGFunctionInfo. ABIType resultTypeABI = getABIType(resultType); -ghp_2xbJR1q3ZrX8jjWL7FTYAmgZJYgkmU2KxLpt - std::vector<ABIType> abiTypes; - abiTypes.reserve(canQualTypes.size()); + ghp_2xbJR1q3ZrX8jjWL7FTYAmgZJYgkmU2KxLpt std::vector<ABIType> abiTypes; + abiTypes.reserve(canQualTypes.size()); for (const llvm::CanQualType &element : argTypes) { abiTypes.push_back(getABIType(element)); } llvm::ArrayRef<ABIType> argTypesABI = llvm::ArrayRef<ABIType>(abiTypes); - ABIFunctionInfo *ABIFI = ABIFunctionInfo::create(CC, isInstanceMethod, isChainCall, isDelegateCall, + ABIFunctionInfo *ABIFI = + ABIFunctionInfo::create(CC, isInstanceMethod, isChainCall, isDelegateCall, info, paramInfos, resultType, argTypes, required); - + // TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() ; ABIInfo::computeFunctionInfo(CodeGenModule::getTargetCodeGenInfo(), ABIFI); @@ -850,8 +851,10 @@ ghp_2xbJR1q3ZrX8jjWL7FTYAmgZJYgkmU2KxLpt unsigned CC = ClangCallConvToLLVMCallConv(info.getCC()); // Construct the function info. We co-allocate the ArgInfos. - // FI = CGFunctionInfo::create(CC, isInstanceMethod, isChainCall, isDelegateCall, - // info, paramInfos, resultType, argTypes, required); + // FI = CGFunctionInfo::create(CC, isInstanceMethod, isChainCall, + // isDelegateCall, + // info, paramInfos, resultType, argTypes, + // required); FunctionInfos.InsertNode(FI, insertPos); bool inserted = FunctionsBeingProcessed.insert(FI).second; `````````` </details> https://github.com/llvm/llvm-project/pull/133080 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits